On Mon, Aug 25, 2008 at 12:45 AM, Bruce Leban <bruce@leapyear.org> wrote:
Jim Jewett wrote:

If I could write:

  class foo:
    def self.bar():
      self.rebar(self.babar)

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():
    $.rebar($.babar)

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.

  def $.bar():
    $.rebar($.babar)

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

    def S.bar():
        S.rebar(S.babar)

--Russ