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

Guido van Rossum guido at python.org
Mon May 1 16:28:59 CEST 2006


On 5/1/06, Edward Loper <edloper at gradient.cis.upenn.edu> wrote:
> > There are two subproposals: first, keyword-only args after a variable
> > number of positional args, which requires allowing keyword parameter
> > specifications after the *args parameter, and second, keyword-only args
> > after a fixed number number of positional args, implemented with a naked
> > '*'.  To the first, I said "The rationale for this is pretty obvious.".  To
> > the second, I asked, and still ask, "Why?".
>
> I was trying to come up with use cases for the "second subproposal."

A function/method could have one argument that is obviously needed and
a whole slew of options that few people care about. For most people,
the signature they know is foo(arg). It would be nice if all the
options were required to be written as keyword arguments, so the
reader will not have to guess what foo(arg, True) means.

This signature style could perhaps be used for the join() builtin that
some folks are demanding: join(iterable, sep=" ", auto_str=False).

For the record, I'm +1 on Talin's PEP, -1 on join.

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


More information about the Python-Dev mailing list