[Python-Dev] PEP 3102: Keyword-only arguments
BJörn Lindqvist
bjourne at gmail.com
Thu May 4 01:21:13 CEST 2006
> > > 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
Me too! I would have thought that the one obvious way to get rid of
the wanky feeling would have been to write:
def make_person(name, age, phone, location): ...
make_person(name, age, phone, location)
IMHO, keyword arguments are often overused like that. Many times they
don't improve readability any more than naming your variables sensibly
do. No, I have not studied how my API:s are used (and how they evolve)
over a longer period of time.
--
mvh Björn
More information about the Python-Dev
mailing list