[Python-Dev] PEP 3102: Keyword-only arguments
Terry Reedy
tjreedy at udel.edu
Mon May 1 18:43:48 CEST 2006
""Martin v. Löwis"" <martin at v.loewis.de> wrote in message
news:4455A0CF.3080008 at v.loewis.de...
> Terry Reedy 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?".
>
> One reason I see is to have keyword-only functions, i.e. with no
> positional arguments at all:
This is not a reason for subproposal two, but a special case, as you
yourself note below, and hence does say why you want to have such.
> def make_person(*, name, age, phone, location):
> pass
And again, why would you *make* me, the user-programmer, type
make_person(name=namex, age=agex, phone=phonex, location = locationx)
#instead of
make_person(namex,agex,phonex,locationx)
?
Ditto for methods.
> In these cases, you don't *want* name, age to be passed in a positional
> way.
I sure you know what I am going to ask, that you did not answer ;-)
Terry Jan Reedy
PS. I see that Guido finally gave a (different) use case for bare * that
does make sense to me.
More information about the Python-Dev
mailing list