PEP 3102 for review and comment

Carl Banks invalidemail at aerojockey.com
Sat May 20 04:00:22 EDT 2006


Talin wrote:
> Specification
>
>     Syntactically, the proposed changes are fairly simple.  The first
>     change is to allow regular arguments to appear after a varargs
>     argument:
>
>         def sortwords(*wordlist, case_sensitive=False):
>            ...
>
>     This function accepts any number of positional arguments, and it
>     also accepts a keyword option called 'case_sensitive'.  This
>     option will never be filled in by a positional argument, but
>     must be explicitly specified by name.

Ick.  Pretty big change hinging on subtle juxtaposition in the argument
list.  I don't like it, it doesn't stand out enough... but it makes
logical sense and any other solution would have to be way more
contrived.  I think argument lists are already confusing enough with
just mixing *, **, and default arguments.

Two thoughts:

Would these arguments go before of after **kwargs?

This is apparently for Python 3.0. (I'd make the implementation
schedule explicit, even if the PEP number implies it's Python 3.0.)  It
looks like Python 3.0 might declare function arguments like Ada.  If
so, what about a little modifier (like Ada's "in and out") instead?
Problem with that is then positional arguments line up wrong.  Ick.

def func(a : int = 1): pass
def func(a : kwonly int = 1): pass


Carl Banks




More information about the Python-list mailing list