PEP 3102 for review and comment

Talin viridia at gmail.com
Mon May 22 23:02:40 CEST 2006


Allowing keyword arguments without defaults may seem like a syntactical
change, but in fact it's not. You can do this in Python now - any
argument can be a 'keyword' argument, whether it has a default value or
not. So for example:

def func( a, b, c=0 ):
   pass

func( a=1, b=2, c=3 )

In other words, the use of '=' to indicate a keyword argument, and the
use of '=' to indicate a default argument value have *nothing* to do
with each other, other than the fact that they both have the
requirement that they have to come after positional arguments.

If you wanted to require keyword-only arguments to have default values,
that would require adding an additional check, which would be a
syntactical change.

-- Talin




More information about the Python-list mailing list