This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skip.montanaro
Recipients ghaering, gregburd, gregory.p.smith, jcea, josiahcarlson, pitrou, rhettinger, skip.montanaro
Date 2008-09-12.01:28:27
SpamBayes Score 2.9329593e-05
Marked as misclassified No
Message-id <18633.50615.329532.529298@montanaro-dyndns-org.local>
In-reply-to <1221175826.5533.1.camel@fsol>
Content
>> 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
History
Date User Action Args
2008-09-12 01:28:58skip.montanarosetrecipients: + skip.montanaro, rhettinger, gregory.p.smith, jcea, ghaering, josiahcarlson, pitrou, gregburd
2008-09-12 01:28:29skip.montanarolinkissue3783 messages
2008-09-12 01:28:27skip.montanarocreate