dict: keys() and values() order guaranteed to be same?
Chris Angelico
rosuav at gmail.com
Mon Jul 23 12:18:54 EDT 2012
More information about the Python-list mailing list
Mon Jul 23 12:18:54 EDT 2012
- Previous message (by thread): dict: keys() and values() order guaranteed to be same?
- Next message (by thread): dict: keys() and values() order guaranteed to be same?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Jul 24, 2012 at 1:20 AM, Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote: > (Although if you think about the implementation of dicts as hash tables, > it does seem likely that it is trivial to enforce this -- one would have > to work *harder* to break that promise than to keep it.) However, it would be quite reasonable to implement a dict as a splay tree, and have values() return them nearest-first. This would mean that just reading from the dictionary could change the order of values(), yet it wouldn't make the implementation non-conformant. Of course, if I want splay tree semantics, I'd rather explicitly ask for that. But it'd be legal. ChrisA
- Previous message (by thread): dict: keys() and values() order guaranteed to be same?
- Next message (by thread): dict: keys() and values() order guaranteed to be same?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list