[Python-3000] Ordered mapping type for Python 3000?

BJörn Lindqvist bjourne at gmail.com
Wed Mar 28 10:51:28 CEST 2007


On 3/28/07, Josiah Carlson <jcarlson at uci.edu> wrote:
>
> "BJörn Lindqvist" <bjourne at gmail.com> wrote:
> > col = attrtuple(r = 255, g = 0, b = 128)
> > r, g, b = col
>
> That is handled reasonably well with Raymond's recipe (or variants
> thereof).

Well, no. NamedTuple('Color', 'r g b')(r = 255, g = 0, b = 128) is not
at all the same thing.

> > el = make_el('input', type = 'text', class = 'query')
>
> XML elements are not ordering sensitive.

Except when you write them. If you want the output to be exactly
<input type = 'text' class = 'query'/> you must have an order.

> > Or interface easier with tabular, order-dependent data.
>
> That is handled with the ordered dictionary and metaclass sytax PEP.

Yes. Making **kwargs orderable would merely be the syntactic support
that would make ordered dictionaries a breeze to work with.

-- 
mvh Björn


More information about the Python-3000 mailing list