[Python-checkins] python/dist/src/Lib sets.py,1.29,1.30
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Thu, 29 Aug 2002 08:13:52 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv10634
Modified Files:
sets.py
Log Message:
Sped _update().
Uses the fast update() method when a dictionary is available.
Index: sets.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** sets.py 26 Aug 2002 00:44:07 -0000 1.29
--- sets.py 29 Aug 2002 15:13:50 -0000 1.30
***************
*** 311,314 ****
--- 311,323 ----
# 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)