[Python-3000] Cleaning up argument list parsing (was Re: More wishful thinking)
Nick Coghlan
ncoghlan at gmail.com
Mon Apr 17 10:41:40 CEST 2006
Guido van Rossum wrote:
> On 4/17/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> A question for Guido: Is this flexibility for argument passing only, or does
>> it apply to parameter declarations as well?
>
> [Nick, could you trim your posts a bit? I'm on a trip with very short
> intervals of net access, and long posts tend to be put in the "later"
> bin forever.]
Will do.
> I think that's a reasonable idea. I didn't read the rest of your mail yet.
The rest of it was just suggesting that permitting keyword
parameters/arguments after *args should be the *only* change we make in this
area. I don't see any point in permitting positional arguments to come after a
keyword argument, even at the call site (this ability was a side effect of
Talin's suggested implementation strategy).
Keeping the positional-before-keyword limitation also permits the
implementation to be simpler. On the calling side, it's just a parser tweak
that doesn't require touching the AST definition.
The function definition side will be a bit trickier. In addition to rippling
all the way down through the AST to the bytecode compiler, function objects
will need some way of reporting "keyword only" arguments as being part of
their signature (probably via an extra attribute). This will affect the
evaluation of function calls (another place to check for keyword arguments)
and may also ripple all the way up to the API of the inspect module.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list