Kaydet (Commit) 1a8d1931 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Sped _update().

Uses the fast update() method when a dictionary is available.
üst fc26c073
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment