[Python-Dev] Proposal: add odict to collections

André Malo nd at perlig.de
Sun Jun 15 01:57:23 CEST 2008


* Armin Ronacher wrote:

> Some reasons why ordered dicts are a useful feature:
>
>   - in XML/HTML processing it's often desired to keep the attributes of
>     an tag ordered during processing.  So that input ordering is the
>     same as the output ordering.
>
>   - Form data transmitted via HTTP is usually ordered by the position
>     of the input/textarea/select field in the HTML document.  That
>     information is currently lost in most Python web applications /
>     frameworks.
>
>   - Eaiser transition of code from Ruby/PHP which have sorted
>     associative arrays / hashmaps.
>
>   - Having an ordered dict in the standard library would allow other
>     libraries support them.  For example a PHP serializer could return
>     odicts rather then dicts which drops the ordering information.
>     XML libraries such as etree could add support for it when creating
>     elements or return attribute dicts.

I find this collection of cases pretty weak as an argument for implementing 
that in the stdlib. A lot of special purpose types would fit into such 
reasoning, but do you want to have all of them maintained here?

nd
-- 
Da fällt mir ein, wieso gibt es eigentlich in Unicode kein
"i" mit einem Herzchen als Tüpfelchen? Das wär sooo süüss!

                                 -- Björn Höhrmann in darw


More information about the Python-Dev mailing list