[Python-ideas] What's going on with PEP 448 - Additional Unpacking Generalizations ?

Guido van Rossum guido at python.org
Tue Jan 20 17:38:47 CET 2015


The PEP hasn't been accepted yet AFAIK...  I'm generally okay with allowing
multiple *x things (except in an *unpack* position of course) but I still
don't think we should be mixing positional and keyword args. So, no f(a,
b=2, c), nor f(a, b=2, *c).

On Tue, Jan 20, 2015 at 6:30 AM, Neil Girdhar <mistersheik at gmail.com> wrote:

> Ok, the final comma means a small change to the grammar.
>
> In summary of the other rules:
>
> positional argument never follow keyword arguments
> iterable argument unpacking never follow keyword argument unpacking
>
> Neither rule is truly necessary, but ok for now.
>
> Best,
>
> Neil
>
>
>
> On Tue, Jan 20, 2015 at 9:22 AM, Joshua Landau <joshua at landau.ws> wrote:
>
>> On 20 January 2015 at 14:18, Joshua Landau <joshua at landau.ws> wrote:
>> > On 20 January 2015 at 11:02, Neil Girdhar <mistersheik at gmail.com>
>> wrote:
>> >>
>> >> f(1, d=4, *[1,2], 2, **{})
>> >
>> > These should be OK, if I've understood the sentiment.
>>
>> I meant, of course, to reply to your fixed version:
>>
>> >> f(1, d=4, *[1,2], **{})
>>
>> wrt.
>>
>> >> Also, if after PEP 448, you can do
>> >>
>> >> f(*a, *b, *c)
>> >>
>> >> and you can always do
>> >>
>> >> f(a,
>> >>   b,
>> >>   c,
>> >>  )
>> >>
>> >> then why shouldn't you be able to do
>> >>
>> >> f(*a,
>> >>   *b,
>> >>   *c,
>> >>  )
>>
>> I see no reason this shouldn't work.
>>
>> On 20 January 2015 at 14:18, Joshua Landau <joshua at landau.ws> wrote:
>> > On 20 January 2015 at 11:02, Neil Girdhar <mistersheik at gmail.com>
>> wrote:
>> >> I've been working on the patch for PEP 448.  Are the restrictions on
>> the
>> >> order of arguments in a function call partially or fully lifted?
>> >
>> > I believe we settled on
>> >
>> >     function(
>> >         argument or *args, argument or *args, ...,
>> >         kwargument or *args, kwargument or *args, ...,
>> >         kwargument or **kwargs, kwargument or **kwargs, ...
>> >     )
>> >
>> > as the most likely candidate.
>> >
>> > Guido said
>> >> Regarding the decision about the allowable syntax for argument lists,
>> >> I prefer to keep the existing restriction
>> >
>> > See
>> https://mail.python.org/pipermail/python-ideas/2013-July/021872.html
>> > for the discussion.
>> >
>> >> Currently, we can do:
>> >> def f(a, b, c, d):
>> >>     pass
>> >>
>> >> f(1, d=4, *[1,2], 2, **{})
>> >>
>> >> After PEP 448 can we do:
>> >>
>> >> f(1, d=4, *[2], c=3, **{})
>> >>
>> >> ?
>> >
>> > These should be OK, if I've understood the sentiment.
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "python-ideas" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/python-ideas/J99EFY1D1nI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> python-ideas+unsubscribe at googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150120/f08fe862/attachment-0001.html>


More information about the Python-ideas mailing list