On 10/9/2013 7:45 AM, Anders J. Munch wrote:

Larry Hastings wrote:

> I look forward to an alternate suggestion.  This is the least-bad

> thing I could come up with.

How about a naming convention instead, where using a leading

underscore in a parameter name is a hint that it is positional-only.

For example, the docstring of sorted:

sorted(iterable, key=None, reverse=False) --> new sorted list

would become:

sorted(_iterable, key=None, reverse=False) --> new sorted list

It seems more intuitive than the slash, and requires no change to the

toolchain.

Although, it may collide slightly with code that uses a leading

underscore to indicate "implementation detail" for a parameter with a

default value, but a quick scan of the std. lib. suggests that that's

very rare.

regards, Anders


So, to avoid that collision, use two leading underscores... a private name for the parameter which can't be specified in the call, similar to private class members that can't (without extreme difficulty) be specified in a reference outside the class.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to