[Python-ideas] Contiguous-array-based ordering for OrderedDict

INADA Naoki songofacandy at gmail.com
Sun Dec 13 00:25:45 EST 2015


> >>> All this looks similar to Raymond's proof-of-concept for a compact
> dictionary (ordering is a side effect). [1]
> >>
> >> But his design only preserves ordering if you never delete (or move,
> but he doesn't have an API for that).
> >
> > This is only because preserving ordering is not a goal for a dict.
>
> Sure. But it is the goal for OrderedDict. Which is exactly why a design
> that makes sense for dict doesn't necessarily make sense for OrderedDict,
> unless you add something else. The hash table of list nodes works as such a
> something else. But Raymond's array doesn't (and isn't intended to).
>
>
FWIW, I think PyPy's dict implementation is advanced version of Raymond's.
More compact and preserves order on deletion.

http://morepypy.blogspot.jp/2015/01/faster-more-memory-efficient-and-more.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151213/84786d68/attachment.html>


More information about the Python-ideas mailing list