[Python-ideas] Positional only arguments
Arnaud Delobelle
arno at marooned.org.uk
Sat May 19 09:22:43 CEST 2007
On Sat, May 19, 2007 7:40 am, Steven Bethard wrote:
[...]
> So should I take that as a +1 for:
>
> * Enforce double-underscore names as being positional-only syntactically,
> e.g.::
>
> def f(__a, __b=None, *, c=42, **kwargs)
>
> Pro: requires no new syntax
> Con: slightly backwards incompatible (but who calls f(__a) anyway?)
>
- There is also incompatibility in the definition of functions: 'def f(a,
__b)' is currently correct, it wouldn't be anymore.
- How would this work with name mangling and methods? For example:
class Foo(object):
def posfun(__self, __a, b, ...):
* Would self have to be renamed __self? (As positional only arguments
should come first)
* Would __self and __a be mangled, as is the rule within classes up to
now? If so care has to be taken I suppose.
--
Arnaud
More information about the Python-ideas
mailing list