On 10/26/2010 07:11 PM, Peter Ingebretson wrote: > The main argument is that preserving immutable objects increases the > complexity of remapping and does not actually solve many problems. > The primary reason for objects to be immutable is so that their > comparison operators and hash value can remain consistent. There are other reasons as well (thread-safety), but I guess those don't really apply to python. I guess one could defend the position that the tuple hasn't really "changed" if its elements merely get upgraded in this way, but it still feels wrong. > Changing, > for example, the contents of a tuple that a dictionary key references > has the same effect as changing the identity of the tuple -- both > modify the hash value of the key and thus invalidate the dictionary. > The full reload processs needs to rehash collections invalidated by > hash values changing, so we might as well modify the contents of > tuples. Do you also rehash when tuples of upgraded objects are used as dict keys?
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