PEP 372 -- Adding an ordered directory to collections
bignose+hates-spam at benfinney.id.au
Mon Jun 16 11:26:12 CEST 2008
Armin Ronacher <armin.ronacher at active-4.com> writes:
> This PEP proposes an ordered dictionary as a new data structure for
> the ``collections`` module, called "odict" in this PEP for short.
A welcome addition.
Since we're not proposing a built-in type, could we choose a name that
is more explicit, and consistent with the types in 'collections'
already. I'd prefer one of the following:
Other (minor) comments:
> The key is not moved but assigned a new value in place. This is
> consistent with existing implementations and allows subclasses to
> change the behavior easily::
> class movingcollections.odict):
Something is missing in the above line of code. It's invalid as-is,
but I don't know which of the many possible replacements is intended.
> Why is there no ``odict.insert()``?
Thank you for this design decision; I agree entirely that the correct
solution is to resequence and create a new ordered dict from the
> A poorly performing example implementation of the odict written in
> Python is available:
> `odict.py <http://dev.pocoo.org/hg/sandbox/raw-file/tip/
This seems to be a victim of errant line-breaking, resulting in the
\ “The reason we come up with new versions is not to fix bugs. |
`\ It's absolutely not.” —Bill Gates, 1995-10-23 |
More information about the Python-list