[Python-3000] Cleaning up argument list parsing (was Re: More wishful thinking)
Nick Coghlan
ncoghlan at gmail.com
Mon Apr 17 10:45:14 CEST 2006
Talin wrote:
> And on the calling side:
>> def func2( adama, valeri, thrace ):
> ...
>> func2( valeri='cylon', 'human', 'human' )
>> In this case, however, I don't see why we can't have the keyword
> arguments out of order. In the above example, the 'valeri' parameter
> gets filled in first, and then the two remaining slots get filled in with
> the positional argumens.
The question to ask in this case is "Why change it?", rather than "Why not?".
In the case of allowing additional keyword arguments after *args, there's a
clear improvement in expressiveness. For function definitions, it permits
keyword-only arguments, for function calls it permits all positional arguments
to be supplied before any keyword arguments.
There isn't any comparable benefit in changing the positional-before-keyword rule.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list