[Python-ideas] PEP: Shorthand Symbol for "self"
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Aug 26 03:02:19 CEST 2008
Bruce Leban wrote:
> If I could write:
>
> class foo:
> def self.bar():
> self.rebar(self.babar)
>
> then the call to object.bar() would match the declaration.
I would rather reserve that syntax for a possible future
enhancement to allow the target of a def statement to
be a more general lvalue.
It's been suggested e.g. that it would be handy to be
able to create tables of functions using things like
def funcs[5](x, y):
...
If that were allowed, then def a.b() would logically
have the meaning of defining a function b as an
attribute of a.
--
Greg
More information about the Python-ideas
mailing list