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

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().
üst c3e61e5c
......@@ -133,7 +133,9 @@ class BaseSet(object):
def copy(self):
"""Return a shallow copy of a set."""
return self.__class__(self)
result = self.__class__([])
result._data.update(self._data)
return result
__copy__ = copy # For the copy module
......
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