[Python-ideas] PEP for issue2292, "Missing *-unpacking generalizations"

Guido van Rossum guido at python.org
Sun Jul 7 01:34:55 CEST 2013


What do yo mean by Status Quo? No version of Python supports multiple
*args or a regular positional arg after *args or after kw=arg.

The only flexibility that was added "recently" (in 2.6) is that kw=arg
may now follow *args.

On Sat, Jul 6, 2013 at 4:03 PM, Joshua Landau
<joshua.landau.ws at gmail.com> wrote:
> On 6 July 2013 23:20, Joshua Landau <joshua.landau.ws at gmail.com> wrote:
>> Then should we expand to allow arbitrary mixing of keyword and
>> positional arguments (which sounds reasonable if we want to allow
>> keyword arguments before *args, and also treat *args like any
>> positional argument)?
>
> To give more hints as to what I am saying:
>
> Original Proposal::
>
>     Function calls may accept an unbound number of ``*`` and ``**``
> unpackings, which are allowed anywhere that positional and keyword
> arguments are allowed respectively. In approximate pseudo-notation::
>
>         function(
>             argument or *args, argument or *args, ...,
>             kwargument or **kwargs, kwargument or **kwargs, ...
>         )
>
>     This has been rejected, primarily as it is not worth the
> backwards-incompatibility.
>
> Status Quo::
>
>     Function calls may accept an unbound number of ``*`` and ``**``
> unpackings. Keyword-arguments must follow positional arguments, and
> ``**`` unpackings must also follow ``*`` unpackings. In approximate
> pseudo-notation::
>
>         function(
>             argument or *args, argument or *args, ...,
>             kwargument or *args, kwargument or *args, ...,
>             kwargument or **kwargs, kwargument or **kwargs, ...
>         )
>
> Looser rulings::
>
>     Function calls may accept an unbound number of ``*`` and ``**``
> unpackings. Arguments can now occur in any position in a function
> call. As usual, keyword arguments always go to their respective keys
> and positional arguments are then placed into the remaining positional
> slots. In approximate pseudo-notation::
>
>         function(
>             argument or keyword_argument or *args or **kwargs,
>             argument or keyword_argument or *args or **kwargs,
>             ...
>         )
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas



-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-ideas mailing list