Hrvoje Niksic <hnik...@xemacs.org> writes:

> Ben Finney <ben+pyt...@benfinney.id.au> writes:
>
> > Tim Chase <python.l...@tim.thechases.com> writes:
> >> Does this "never trust it" hold even for two consecutive iterations
> >> over an unchanged dict? I didn't see anything in the docs[1] to make
> >> such a claim,
> >
> > Exactly.
>
> This is false.  The docs say:
>
>     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(d.values(),
>     d.keys()).
>
> (http://docs.python.org/library/stdtypes.html#mapping-types-dict)

Thank you for this correction.

-- 
 \       “Firmness in decision is often merely a form of stupidity. It |
  `\        indicates an inability to think the same thing out twice.” |
_o__)                                                —Henry L. Mencken |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to