[Python-ideas] Preserving **kwargs order (was: Re: OrderedDict literals)
Andrew Barnert
abarnert at yahoo.com
Thu Mar 20 02:58:30 CET 2014
On Mar 19, 2014, at 16:32, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> Hopefully I'll have time to write a proto-PEP on this in the next
> couple weeks, but the gist is that I see 2 options:
Last time around, someone suggested that ***kwargs could get you the args as a list of pairs, or maybe an OrderedDict. While that would require a bit of complexity in the CALL_FUNCTION code, it seems like it would be simpler than your option 2.
But it doesn't solve the main problem. Right now, you can forward any arguments perfectly by doing this:
def wrapper(*args, **kwargs):
return wrappee(*args, **kwargs)
Your option 2 would require much more verbose code to forward perfectly. The triple-star idea makes it a lot nicer (assuming that ** passing respects the order, or a new *** is added there as well), but it would still break the thousands of wrapper functions out there written with **kwargs.
More information about the Python-ideas
mailing list