
Jim Jewett wrote:
One of the problems with the current syntax is that calling sites
don't match the definition site the way they do for normal functions. This proposal doesn't seem to help with that. ...
def m(self, a, b, z=None): ...
# self is moved outside the parens, changing the tuple size self.m(a, b, z) self.m(a, b)
On Sun, Aug 24, 2008 at 6:26 PM, Terry Reedy <tjreedy@udel.edu> wrote:
If m is an attribute of type(s) (which is s.__class__), this shrinkage is a convenient abbreviation, not a requirement. The above calls are the same as type(s).m(s.a,b,z) or type(s).m(s,a,b). Or, if you prefer, fn = type(s).m # or s.__class__.m fn(s,a,b,z) If m is an attribute s, and s in not a class, the shrinkage is not available, and one must write s.m(s,a,b,z) or s.m(s.a,b).
Terry Jan Reedy
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. --- Bruce