PEP 372 -- Adding an ordered directory to collections
Ben Finney
bignose+hates-spam at benfinney.id.au
Mon Jun 16 05:26:12 EDT 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:
collections.ordereddict
collections.ordered_dict
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
result.
> A poorly performing example implementation of the odict written in
> Python is available:
>
> `odict.py <http://dev.pocoo.org/hg/sandbox/raw-file/tip/
> odict.py>`_
This seems to be a victim of errant line-breaking, resulting in the
wrong URL.
--
\ “The reason we come up with new versions is not to fix bugs. |
`\ It's absolutely not.” —Bill Gates, 1995-10-23 |
_o__) |
Ben Finney
More information about the Python-list
mailing list