php vs python

Erik Max Francis max at
Sun Jan 5 06:47:10 CET 2003

aonaran at wrote:

> With the introduction of iterators in python 2.2 (IIRC) it's even
> simpler:
>         for key, val in d.items():
>             print key,'=',val

This actually doesn't have anything to do with iterators, this has been
good Python since 1.5.2 at least.  In 2.x, the dictionary itself is an
iterable object and iterating over it is equivalent to iterating over
its keys.

 Erik Max Francis / max at /
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ War is a continuation of policy by other means.
\__/ Karl von Clausewitz
    CAGE /
 A cellular automaton simulation system in Python.

More information about the Python-list mailing list