[Python-ideas] PEP: Shorthand Symbol for "self"
russ.paielli at gmail.com
Mon Aug 25 13:19:08 CEST 2008
On Mon, Aug 25, 2008 at 12:45 AM, Bruce Leban <bruce at leapyear.org> wrote:
> Jim Jewett wrote:
> If I could write:
> class foo:
> def self.bar():
> then the call to object.bar() would match the declaration.
> Back to Russ's proposal: it would be better accomodated IMHO by allowing $
> as a character in a variable name, just like _ is. Then, conventionally,
> people could use $ as self:
> def $.bar():
> and for whatever it's worth, I find $.bar easier to read then $bar as the
> explicit dot reminds me it's doing an attribute get rather than looking like
> a special variable name.
That's two separate proposals, but I think I like both of them.
Of course, Python already allows "S", which is very similar to "$", as the
first argument, so we're almost there on that aspect of it. Come to think of
it, I may start using "S" and see how it works out.
So how about
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas