On Fri, Apr 11, 2014 at 7:49 AM, Nick Coghlan <ncoghlan@gmail.com> wrote:

> Not really.   It was just a silly example for conciseness.  I don't care how
> you build up the OrderedDict, and there are several order-preserving ways to
> do that.  I'm not sure it's a good idea to change *all of Python* just to make
> the OD constructor nicer.

It's not "all of Python" - it's only functions that accept **kwargs. And when your code is speed critical, doing that's already a bad idea.


And it is not just about OrderedDict.  There are many other examples where it is helpful to be able to supply arbitrary keyword arguments and have the order preserved.  For example, when building a memory view to a C struct, a nice interface would be struct_view(foo=int, bar=float).  Another example is constructing tables.  One may want to supply column info in keyword arguments named as columns.