[Python-3000] Cleaning up argument list parsing (was Re: More wishful thinking)
Nick Coghlan
ncoghlan at gmail.com
Fri Apr 21 12:23:39 CEST 2006
Jim Jewett wrote:
> On 4/20/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> Some legal combinations:
>>
>> f(1, 2, 3, d=1) # Positional args a, b and c
>> f(1, 2, 3, 4, 5, 6, d=1) # Positional args a, b and c and (4, 5, 6) as args
>> f(2, a=1, d=1) # Provide a as a keyword arg instead
>
> So positional would still have to occur before keywords, but only if
> they were passed as positional? Today, that third one gets a
> TypeError for assigning multiple values to a.
My mistake - I thought that was currently legal, and didn't check it. So no,
I'd keep the current rule - once you pass one positional argument as a
keyword, you have to do the same for all subsequent positional arguments.
Which implies that "positional-only" arguments would have to come *before* the
current normal arguments that can be passed either way.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list