mirror of
https://github.com/python/cpython.git
synced 2025-12-10 19:10:59 +00:00
Sped _update().
Uses the fast update() method when a dictionary is available.
This commit is contained in:
parent
fc26c0730c
commit
1a8d193121
1 changed files with 9 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue