diff options
Diffstat (limited to 'Lib/sets.py')
-rw-r--r-- | Lib/sets.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/sets.py b/Lib/sets.py index 5007709..069be64 100644 --- a/Lib/sets.py +++ b/Lib/sets.py @@ -310,6 +310,15 @@ class BaseSet(object): def _update(self, iterable): # The main loop for update() and the subclass __init__() methods. data = self._data + + # Use the fast update() method when a dictionary is available. + if isinstance(iterable, BaseSet): + data.update(iterable._data) + return + if isinstance(iterable, dict): + data.update(iterable) + return + value = True it = iter(iterable) while True: |