>> select key from dict order by key
>> select value from dict order by key
Guido> What's the purpose of the "order by key" clauses here? Doesn't
Guido> that force the return order? Perhaps you meant to leave those
Guido> out?
It's simply to guarantee that the order of the elements of values() is the
same as the order of the elements of keys(). Again, I was thinking that
this property: zip(d.keys(), d.values()) == d.items() was a desirable
property of mappings, not just of the CPython dict implementation.
So is there a definition of what it means to be a mapping? Maybe this page
in the C API doc?
http://docs.python.org/api/mapping.html
>From that I infer that a mapping must offer these methods: keys, values,
items, __len__, __contains__, __getitem__, __setitem__ and __delitem__. No
guarantee about the ordering of keys, values and items is made. Can we
settle on something like this and spell it out explicitly somewhere in the
3.0 docs?
Skip
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com