[Python-3000] Pronouncement on parameter lists

Talin talin at acm.org
Fri Apr 21 20:29:37 CEST 2006


Jim Jewett <jimjjewett <at> gmail.com> writes:

> It has not yet been specified what would happen to additional
> positional arguments that get passed in anyway.  (Swallow or raise an
> Exception?)

Additional positional arguments would be treated exactly as if you attempted 
to pass too many positional arguments to a function that took a fixed number 
of arguments. In other words, raise TypeError.

> 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

Defaults and keywords have nothing to do with each other, other than the fact 
that they both use the '=' sign. So both examples above would be OK, however 
if you failed to supply a value for 'x', that would be an error in the second 
example, but not the first.

-- Talin




More information about the Python-3000 mailing list