[Python-ideas] Ordered Dictionary Literals

Nick Coghlan ncoghlan at gmail.com
Wed Nov 11 22:13:07 CET 2009


Richard Saunders wrote:
> Has there been any discussion about making a "better" OrderedDict
> literal? I did
> some googling and didn't find anything.

I think we want to see it get some more field testing as part of the
collections module before bringing it into the core of the language is
seriously considered. If it's popular and useful, then doing so is
definitely a possibility though.

The history of the set builtin (i.e. first introduced in a module, then
made a builtin, then given literal syntax) is indicative of the kind of
time frames we're talking about here.

Rather than immediately jumping to a literal though, it might prove to
be more fruitful to explore the use of an ordered dictionary for keyword
arguments. Without that, convenient shortcuts like "OrderedDict(a=1,
b=2, c=3)" would never become possible.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------



More information about the Python-ideas mailing list