[Python-3000] Pronouncement on parameter lists
jimjjewett at gmail.com
Fri Apr 21 20:14:30 CEST 2006
On 4/21/06, Alex Martelli <aleaxit at gmail.com> wrote:
> On 4/21/06, Guido van Rossum <guido at python.org> wrote:
> > To prevent more abominations like this, let me pronounce that I now
> > like the single-star syntax:
> > def foo(a, b, *, x=1, y=2): ...
> So, what will this syntax signify? If the single-star stands for
> "arbitrary positional arguments", how will the body of foo access
> them? Sorry if these have been well covered already, but I read back
> through this thread and couldn't find them.
No, *args stands for arbitrary positional arguments.
The unadorned * stands for "anything after this must be passed as a keyword".
It has not yet been specified what would happen to additional
positional arguments that get passed in anyway. (Swallow or raise an
It has not yet been specified whether the keyword-only arguments must
each have a default. Most proposals assume not, but then do ugly
things to support that assumption. The above suggests
def foo(a, b=2, *, x=3, y=4): # OK
def foo(a, b=2, *, x, y=4): # not yet decided
More information about the Python-3000