[Python-ideas] Proto-PEP: Preserving the order of **kwargs in a function.
Nick Coghlan
ncoghlan at gmail.com
Sun Apr 6 12:39:51 CEST 2014
On 6 April 2014 15:43, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> Here's the proper proposal I promised. Hopefully it reflects our
> discussions and the past ones too. My goal here is to focus in on
> what I consider to be the most viable approach, which capturing the
> gist of the various concerns and alternatives. There are still a few
> small gaps that I will work on as time permits. Feedback is welcome.
Nice! One specific comment below.
> Relationship to **-unpacking syntax
> -----------------------------------
>
> The ** unpacking syntax in function calls has no special connection with
> this proposal. Keyword arguments provided by unpacking will be treated
> in exactly the same way as they are now: ones that match defined
> parameters are gather there and the remainder will be collected into the
> ordered kwargs (just like any other unmatched keyword argument).
There *is* a connection here: this needs to play nice with the ordered
kwargs in order to handle the pass-through case correctly.
The guarantee that the order of the supplied mapping (minus any
entries that map to named parameters) will be preserved needs to be
made explicit.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list