[Python-Dev] PEP 3102: Keyword-only arguments

Greg Ewing greg.ewing at canterbury.ac.nz
Tue May 2 13:07:33 CEST 2006


Terry Reedy wrote:

> my way to call your example (given the data in separate variables):
>   make_person(name, age, phone, location)
> your way:
>   make_person(name=name, age=age, phone=phone, location = location)

For situations like that, I've sometimes thought
it would be useful to be able to say something like

   make_person(=name, =age, =phone, =location)

> It is a feature of Python that arguments can usually be matched to 
> parameters either by position or name, as the *caller* chooses.

Except that the caller doesn't always get that option
even now, if the callee has chosen to use *args or **kwds.
So I wouldn't consider that a very strong argument.

> And they need not; it is right there in front of them.  As for writers, 
> modern IDEs should try to list the parameter signature upon typing 'func('.

Which is extremely difficult for an IDE to do without
static type information.

--
Greg


More information about the Python-Dev mailing list