[Python-ideas] keyword arguments everywhere (stdlib) - issue8706
ethan at stoneleaf.us
Sat Mar 3 00:09:19 CET 2012
Guido van Rossum wrote:
> On Fri, Mar 2, 2012 at 2:49 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
>> Terry Reedy wrote:
>>> On 3/2/2012 3:32 PM, Ethan Furman wrote:
>>>> So something like:
>>>> def ord(char, ?):
>>>> def split(self, char, ?, count)
>>>> def canary(breed, ?, color, wingspan, *, name)
>>> That is probably better than using '$' or directly tagging the names.
>> I chose '?' because it has some similarity to an incompletely-drawn 'p', and
>> also because it suggests a sort of vagueness, as in not being able to
>> specify the name of the argument.
> I'd rather not start using a new punctuation character for this one
> very limited purpose; it might prevent us from using ? for some other
> more generic purpose in the future.
> Alternative proposal: how about using '/' ? It's kind of the opposite
> of '*' which means "keyword argument", and '/' is not a new character.
So it would look like:
def ord(char, /):
def split(self, char, /, count)
def canary(breed, /, color, wingspan, *, name)
I think I like that better -- it stands out, and it looks like a barrier
between the positional-only and the positional-keyword arguments.
More information about the Python-ideas