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

Guido van Rossum guido at python.org
Wed May 3 04:32:48 CEST 2006


On 5/2/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
> > On 5/2/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>
> > >    make_person(=name, =age, =phone, =location)
> >
> > And even with Terry's use case quoted I can't make out what you meant
> > that to do.
>
> I meant it to do the same thing as
>
>    make_person(name=name, age=age, phone=phone, location=location)
>
> I come across use cases for this fairly frequently, usually
> when I have an __init__ method that supplies default values
> for a bunch of arguments, and then wants to pass them on to
> an inherited __init__ with the same names. It feels very
> wanky having to write out all those foo=foo expressions.

Sorry, but leading = signs feel even more wanky. (That's a technical
term. ;-) It violates the guideline that Python's punctuation should
preferably mimic English; or other mainstram languages (as with 'x.y'
and '@deco').

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list