On Thu, Sep 20, 2012 at 7:12 AM, Benjamin Peterson <benja...@python.org> wrote:
> def f(a, b, c, *args, d):
>      pass
>
> a, b, and c are positional. Hence the "positional" in error messages.
>
> As you noted in your next message, keyword-only arguments need to be
> distinguished from these "positional" arguments somehow. Maybe it
> helps to think of "positional" to mean "the only formals you can pass
> to with position" (excepting variadic ones).

That is how I think of "positional".

However, the other wrinkle is that some arguments really are
"position-only," for example:

>>> len(s="abc")
Traceback (most recent call last):
 ...
TypeError: len() takes no keyword arguments

I think it is a defect of our documentation that we don't have a way
to distinguish between "positional" and "position-only" arguments in
the function signature notation we use in our documentation, leading
to issues like this one:

"accept keyword arguments on most base type methods and builtins":

http://bugs.python.org/issue8706

--Chris
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to