Proposed implementation for an Ordered Dictionary

Michele Simionato michele.simionato at gmail.com
Sun Mar 1 05:16:47 CET 2009


On Mar 1, 1:43 am, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> "Colin J. Williams" <c... at ncf.ca> writes:
>
> >      # print [mydict[x] for x in sorted(mydict.keys)] Instance object
> > is not iterable
>
> It was a typo.  Use:
>
>     print [mydict[x] for x in sorted(mydict.keys())]

Even better

print [mydict[x] for x in sorted(mydict)]



More information about the Python-list mailing list