PEP 318
Nicolas Fleury
nid_oizo at yahoo.com_removethe_
Sun Mar 21 14:45:39 EST 2004
Marco Bubke wrote:
> def foo(x, y) as staticmethode: pass
>
> Define foo with arguments x and y as staticmethode.
>
> Is Python now C++? Mabe I miss something why this syntax is wrong.
Personnally, I prefer the "as" syntax to the other proposed (and by a
large margin). However, I feel that it is making the language more
complex and I'm far from sure it's worth the effort. I've given some
Python courses, and the first reaction when showing a class with some
methods is something like "so I guess when the first parameter is not
named 'self' it makes a class method?". So I have to explain it's not
the case, etc.
If easing the creation of class methods is so important, I would prefer
a more radical approach with a end result that would be more intuitive
to newcomers:
- Give a warning for all methods with first parameter not named "self"
in next versions of Python.
- In a future major version of Python, 3 or 4, self becomes a keyword
and a first parameter named otherwise implies a class method (I
understand it could mean a lot of changes in code not using self).
Regards,
Nicolas
More information about the Python-list
mailing list