Message32061
While the OP knows what he means here, the suggested text does not add clarity, it only makes the subject harder to understand and implies that some mysterious, dark force is in place. Further, the suggested text is simply incorrect. Given deterministic assignment of hash values and a consistent insertion order, the order of keys in a set or dictionary is fully determined.
I've read the source of this suggestion on comp.lang.python and commented there. The underlying issue had nothing to do with either sets or dicts. The code in question "re-discovered" that the location of objects in memory would vary between runs if the user deleted a pyc file for a module. The OP's script used object ids as hash values, hence the set/dict ordering could vary between runs. This was at odds with his expectation that that the ordering would be deterministic. The moral is that non-deterministic hash values lead to non-deterministic set/dict ordering.
The docs for sets and dicts should not be muddled with tangential discussions about implementation specific details regarding what governs where objects are placed in memory.
|
|
Date |
User |
Action |
Args |
2007-08-23 14:53:52 | admin | link | issue1721368 messages |
2007-08-23 14:53:52 | admin | create | |
|