[Python-Dev] Proposal: add odict to collections

Phillip J. Eby pje at telecommunity.com
Sun Jun 15 16:52:20 CEST 2008


At 02:34 PM 6/15/2008 +0000, Antoine Pitrou wrote:
>Phillip J. Eby <pje <at> telecommunity.com> writes:
> >
> > As for the other uses for ordered dictionaries, I find it simplest to
> > just use a list of key,value pairs, and only transform it to a
> > dictionary or dictionary-like structure as needed, using tools like
> > the cgi module, the email package, or wsgiref.headers.
>
>What you are saying is that there are already generally useful container
>types in the stdlib, but isn't it a good argument in favor of ripping them
>out of domain-specific packages and provide them as generic classes in the
>collections module?
>
>Someone never using cgi or wsgiref wouldn't know that some of the code there
>can be useful for other purposes.

I didn't say I used them for other purposes, or that they were 
generally useful.  Rather, they're specifically useful for the things 
they're useful for.

More often than not, the use case calls for not merely ordering, but 
ordering of *values*, with multiple values for each key.  But the 
precise API desired for manipulating such structures tends to be 
highly app-specific (like email, CGI form values, HTTP headers, 
etc.), so it's actually IMO an argument *against* a general odict type.



More information about the Python-Dev mailing list