[Python-3000] Cleaning up argument list parsing (was Re: More wishful thinking)

Guido van Rossum guido at python.org
Mon Apr 17 20:40:41 CEST 2006


On 4/17/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
> 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).

Right. In the call foo(1, 2, abc=42, 3), what's the sequential
parameter position for the 3? I think it's ambiguous in the sense that
reasonable users could disagree what would be the best choice.

But in foo(1, 2, *args, 3, 4) there's no harm; nor is there harm in
foo(1, 2, *args, abc=42, **kwds). I'm on the fence about foo(*args,
**kwds, abc=42).

Here's a related but more complicated wish: define a function in such
a way that certain parameters *must* be passed as keywords, *without*
using *args or **kwds. This may require a new syntactic crutch.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list