Dictionary .keys() and .values() should return a set [with Python 3000 in mind]

Roy Smith roy at panix.com
Sat Jul 1 23:43:23 EDT 2006


"Nick Vatamaniuc" <vatamane at gmail.com> wrote:
> But there is a side note:  old code that assumed a particular ordering 
> of the keys or values is broken anyway.

>From a testing point of view, it would be interesting if there was a flag 
which said, "Deliberately change everything which isn't guaranteed to be a 
specific way".  So, for example, dict.keys() would return a list in reverse 
order of how it normally does it (even if it cost more to do it that way).  
An alternate hash key generator would be slipped into place.  Floating 
point math would get a little noise added to the least significant bits.  
And so on.  Might be interesting to see what sorts of bugs that would shake 
out from user code.



More information about the Python-list mailing list