[Python-checkins] python/dist/src/Lib sets.py,1.11,1.12
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Wed, 21 Aug 2002 06:20:53 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv1654
Modified Files:
sets.py
Log Message:
Now that __init__ transforms set elements, we know that all of the
elements are hashable, so we can use dict.update() or dict.copy()
for a C speed Set.copy().
Index: sets.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** sets.py 21 Aug 2002 04:12:03 -0000 1.11
--- sets.py 21 Aug 2002 13:20:51 -0000 1.12
***************
*** 134,138 ****
def copy(self):
"""Return a shallow copy of a set."""
! return self.__class__(self)
__copy__ = copy # For the copy module
--- 134,140 ----
def copy(self):
"""Return a shallow copy of a set."""
! result = self.__class__([])
! result._data.update(self._data)
! return result
__copy__ = copy # For the copy module