Skip Montanaro <[EMAIL PROTECTED]> added the comment: >> Well, sure, but heaven only knows what an application programmer will >> do...
Antoine> If the docs clearly explain that there is no guarantee, we Antoine> don't need heaven. I would find it strange to potentially ruin Antoine> performance just for a guarantee which has no useful purpose. >From <http://docs.python.org/lib/typesmapping.html>: If items(), keys(), values(), iteritems(), iterkeys(), and itervalues() are called with no intervening modifications to the dictionary, the lists will directly correspond. This allows the creation of (value, key) pairs using zip(): "pairs = zip(a.values(), a.keys())". The same relationship holds for the iterkeys() and itervalues() methods: "pairs = zip(a.itervalues(), a.iterkeys())" provides the same value for pairs. Another way to create the same list is "pairs = [(v, k) for (k, v) in a.iteritems()]". While the emphasis is on dictionaries, it seems to me that page describes the notation and properties of mappings in general, not specifically dictionaries. I think it might be worthwhile to get a verdict from Guido on this one. Skip _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3783> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com