[Python-3000] Is this really a SyntaxError?

Raymond Hettinger python at rcn.com
Thu Jul 31 07:51:58 CEST 2008


Yea!  I'm very happy about this.


----- Original Message ----- 
From: "Guido van Rossum" <guido at python.org>
To: "Amaury Forgeot d'Arc" <amauryfa at gmail.com>
Cc: <python-3000 at python.org>
Sent: Wednesday, July 30, 2008 9:03 PM
Subject: Re: [Python-3000] Is this really a SyntaxError?


> Cool.
> 
> I hope others can review, and you should ask Barry if this is okay for beta3.
> 
> On Wed, Jul 30, 2008 at 6:17 PM, Amaury Forgeot d'Arc
> <amauryfa at gmail.com> wrote:
>> 2008/7/30 Guido van Rossum <guido at python.org>:
>>> On Wed, Jul 30, 2008 at 2:34 AM, Amaury Forgeot d'Arc
>>> <amauryfa at gmail.com> wrote:
>>>
>>>> I hope this patch is simple enough for you:
>>>>
>>>> Index: Grammar/Grammar
>>>> ===================================================================
>>>> --- Grammar/Grammar     (revision 65298)
>>>> +++ Grammar/Grammar     (working copy)
>>>> @@ -113,7 +113,9 @@
>>>>
>>>>  classdef: 'class' NAME ['(' [arglist] ')'] ':' suite
>>>>
>>>> -arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test)
>>>> +arglist: (argument ',')* (argument [',']
>>>> +                         |'*' test (',' NAME '=' test)* [',' '**' test]
>>>> +                         |'**' test)
>>>>  argument: test [comp_for] | test '=' test  # Really [keyword '='] test
>>>>
>>>>  comp_iter: comp_for | comp_if
>>>>
>>>>
>>>> (and call pgen to rebuild the graminit.c)
>>>>
>>>> Positional arguments after the *args are explicitly disallowed:
>>>>        f(1, *[2, 3], 4, z=5)
>>>> The syntax could make sense, but this would require more changes in
>>>> the compiler,
>>>> to properly order the parameters.
>>>
>>> Are you saying that after the above Grammar change, the code generator
>>> already does the right thing for Raymond's code?
>>
>> Yes! the ast builder simply collects items from the parenthesized sequence,
>> and does not care about the ordering - except for an explicit
>> "non-keyword arg after keyword arg".
>>
>>> Then I say go for it
>>> -- but please do add new unit tests.
>>
>> Of course -- I was just requesting approval.
>> I am working on a documentation patch as well, and filed
>> http://bugs.python.org/issue3473
>>
>> --
>> Amaury Forgeot d'Arc
>>
> 
> 
> 
> -- 
> --Guido van Rossum (home page: http://www.python.org/~guido/)
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/python%40rcn.com


More information about the Python-3000 mailing list