Skip to content

Commit

Permalink
Updated widget registry implementation comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Aug 16, 2023
1 parent d0c05f3 commit b56afd6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/src/toga/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@


class WidgetRegistry(WeakValueDictionary):
# WidgetRegistry is implemented as a subclass of dict, because it provides
# a mapping from ID to widget. However, it exposes a set-like API; add()
# and update() take instances to be added, and iteration is over values.
# WidgetRegistry is implemented as a subclass of WeakValueDictionary, because it
# provides a mapping from ID to widget. However, it exposes a set-like API; add()
# and update() take instances to be added, and iteration is over values. The
# mapping is weak so the registry doesn't retain a strong reference to the widget,
# preventing memory cleanup.

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down

0 comments on commit b56afd6

Please sign in to comment.