I would like to confirm my understanding of copying and its implications. A shallow copy builds only a new outer shell and leaves the inner references unchanged. If the outer object is immutable, then a copy might as well be the original object. So, in the copy module, the copy function for tuples should just return the original object (the function looks like it does more but actually does return itself). And, since a frozenset is immutable, its copy function should also just return self. The point of a deepcopy is to replace each sub-component (at every nesting level) that could possibly change. Since sets can only contain hashable objects which in turn can only contain hashable objects, I surmise that a shallowcopy of a set would also suffice as its deepcopy. IOW: For frozensets, shallowcopy == deepcopy == self For sets, shallowcopy == deepcopy == set(list(self)) # done with PyDict_Copy() Raymond Hettinger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20031122/3de21c58/attachment.html
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4