New Ordered Dictionery to Criticise

Fuzzyman fuzzyman at
Tue Nov 29 10:27:02 CET 2005

Christoph Zwerschke wrote:
> Fuzzyman wrote:
> > Sorry for this hurried message - I've done a new implementation of out
> > ordered dict. This comes out of the discussion on this newsgroup (see
> > blog entry for link to archive of discussion).
> Thanks. I'll try to check it out and put my oar in over the next
> weekend.

Cool, thanks.

Someone has commented on my blog that passing lists to ``keys``,
``values``, and ``items`` to assign to them "smells funny".

They've suggested new methods ``setkeys``, ``setitems``, ``setvalues``
instead. Any opinions ?

> One thing I already noticed: str() and repr() both output the
> OrderedDict as if it was an ordinary dictionary. For str() this may be
> acceptable, but repr() should output "a valid Python expression that
> could be used to recreate an object with the same value".

Yup. If you look in the code, there is already a commented out version
of ``__repr__`` that does this.

*Unfortunately*, it means changing *all* the doctests - so it will have
to wait until one of us can be bothered. :-)

It  will happen in the course of time I guess.

All the best,


> -- Christoph

More information about the Python-list mailing list