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

Terry Reedy tjreedy at udel.edu
Sun Mar 4 21:59:56 CET 2012

On 3/3/2012 3:39 PM, Guido van Rossum wrote:

> Yeah, so it does make sense to standardize on a solution for this

Agreed. There are actually two issues.
Doc: indicate intent, regardless of how enforced in code.
Code: indicate intent to interpreter so it enforces intent rather than 
programmer doing do with *args, defaults if any, and error messages.

> Let it be @positional(N).

You seem to have backed off on that. I would like a solution for the 
docs that Georg can tolerate.

> Can you file an issue?

When you have settled on one thing for at least a day ;-).
Until then, I think it is better to keep discussion in one place, which 
is here.

The pos(n) idea does not work because position-only args may still have 
defaults. For instance, range() takes 1 to 3 args. That proposal did 
give me this idea: tag positional names with their index. In a sense, 
the index *is* the internal name while apparent alphabetic name is 
suggestive for human understanding.

For doc purposes, the tag could be either a prefix or suffix. Either 
way, it would be a convention that does not conflict with any stdlib 
names that I know of.

range(start_0 = 0, stop_1, step_2 = 1)
   Retern ...

range(0_start = 0, 1_stop, 2_step = 1)
   Return ...

For Python code, I presume the prefix form would be rejected by the 
lexer. A possibility would be 'mangled' dunder names in the signature, 
such as __0_start__, which would be stripped to 'start' for use in the code.

If this idea makes '/' look better, fine with me.

Terry Jan Reedy

More information about the Python-ideas mailing list