d.keys() and d.values()

Gerrit Holl gerrit at nl.linux.org
Tue Jun 24 16:32:32 CEST 2003

Oren Tirosh wrote:
> On Tue, Jun 24, 2003 at 12:03:33PM +0200, Gerrit Holl wrote:
> > Hi,
> > 
> > is it guaranteed that dict(zip(d.keys(), d.values())) == d?
> > In words, do .keys() and .values() always have the same order? Is
> > it safe to rely on this?
> Yes, as long as the dictionary is not modified between these calls.
> http://www.python.org/doc/current/lib/typesmapping.html

Oops! I should have searched the docs more carefully.



121. If any one store corn in another man's house he shall pay him
storage at the rate of one gur for every five ka of corn per year.
        -- 1780 BC, Hammurabi, Code of Law
Asperger Syndroom - een persoonlijke benadering:
Het zijn tijden om je zelf met politiek te bemoeien:

More information about the Python-list mailing list