[Python-ideas] Preserving **kwargs order

Andrew Barnert abarnert at yahoo.com
Fri Apr 4 19:46:37 CEST 2014


On Apr 4, 2014, at 10:15, random832 at fastmail.us wrote:

> On Fri, Apr 4, 2014, at 12:04, David Mertz wrote:
>> I confess that after reading this thread, and a number of related past
>> ones, I'm still not certain exactly what problem all of this is needed to
>> solve.  ISTM that if one has a special function calling requirement to
>> pass
>> in an ordered collection of key/value pairs, one can already just use a
>> special and available call signature for your function:
> 
> People want to be able to pass them in order __with the a=1, b=2
> syntax__. Because the syntax you're proposing looks like grit on my
> monitor.
> 
> The most commonly cited desired use case is for the OrderedDict

Every time this comes up, that's the only good example anyone comes up with. It's obviously a special case. Besides being self-referential, a solution to that one case would automatically drastically improve the workarounds for any other case that anyone else later finds.

If we need a general-purpose solution, then it has to be general-purpose. It has to work with dynamically-identified callables, forwarding wrappers, etc. And that's hard. If we only need OrderedDict to work, there are a lot fewer requirements.


More information about the Python-ideas mailing list