[Python-3000] Type Expressions

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Apr 22 03:14:25 CEST 2006


Alex Martelli wrote:

>>  def foo(a, b, *, x=1, y=2): ...
> 
> So, what will this syntax signify?

This particular example means "a and b are required positional
arguments, no other positional arguments are allowed, and
x and y are optional keyword-only arguments".

>  If the single-star stands for
> "arbitrary positional arguments", how will the body of foo access
> them?

To allow extra positional args, you would need a name
after the *, same as now.

--
Greg


More information about the Python-3000 mailing list