[Python-ideas] OrderedDict.insert()

Eric Snow ericsnowcurrently at gmail.com
Thu Mar 26 23:06:06 CET 2015


On Wed, Mar 25, 2015 at 5:00 AM, Thomas Güttler
<guettliml at thomas-guettler.de> wrote:
> I am missing OrderedDict.insert()
>
> Other people, too:
>
>
> http://stackoverflow.com/questions/16664874/how-can-i-add-the-element-at-the-top-of-ordereddict-in-python
>
> Why was it not implemented up to now?
>
> Why not implement it for the future?

Ordered dict is a dict that preserves insertion order (and exposes via
iteration-related methods like __iter__ and the views).  That's it.
It is not a dict that also implements Sequence.  Keep in mind that
OrderedDict is a fairly simply adaptation of dict.  Unfortunately
there is a lingering temptation to think of it as a sequence.

-eric


More information about the Python-ideas mailing list