[Python-ideas] keyword arguments everywhere (stdlib) - issue8706

Guido van Rossum guido at python.org
Fri Mar 2 23:46:43 CET 2012

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:
>>> Guido van Rossum wrote:
>>>> I would actually like to see a syntactic feature to state that an
>>>> argument *cannot* be given as a keyword argument (just as we already
>>>> added syntax to state that it *must* be a keyword).
>> I think this is what we need. I see the problem as being that a) C and
>> Python functions work differently, and b) the doc does not -- and should not
>> -- specify the implementation. One solution is to make all C functions work
>> like Python functions. The other is to allow Python functions to work like C
>> functions. Given the reasonable opposition to the first, we need the second.
>>> 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 do not know if it is the best possible way, and am looking forward to
> other ideas.

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.

--Guido van Rossum (python.org/~guido)

More information about the Python-ideas mailing list