[Python-ideas] Positional only arguments

Greg Ewing greg.ewing at canterbury.ac.nz
Mon May 21 09:07:12 CEST 2007


Steven Bethard wrote:
> That means that in the following signature::
> 
>     def f(*, a, b=None, *args, **, c=42, **kwargs)

I don't like this. Having more than one * or ** in
the same signature seems like it would be very confusing.

I think the desire for positional-only args would be
addressed well enough using a naming convention. Even
without further explanation, if I saw something like

   def f(_a, _b, _c):
     ...

it would be pretty clear to me that the author intended
the parameter names to be an implementation detail.

This could even be enforced if relying on a convention
were not considered strong enough, although it would
be more consistent to insist on a double underscore to
get automatic enforcement.

--
Greg



More information about the Python-ideas mailing list