dictionary: keys() and values()
pyth at devel.trillke.net
Fri Jun 14 00:09:50 CEST 2002
Irmen de Jong wrote:
> Andrew Koenig wrote:
> > From the library reference, 2.2.7, footnote 3:
> > If keys() and values() are called with no intervening modifications to the
> > dictionary, the two lists will directly correspond. This allows the creation
> > of (value, key) pairs using zip(): "pairs = zip(a.values(), a.keys())".
> Why would you want to do that if you have .items()?
i almost fell for the same question untill i looked harder<wink>.
order-sometimes-matters-ly y'rs, Holger
More information about the Python-list