Nikolaus Rath wrote:
Terry Reedy <[EMAIL PROTECTED]> writes:
Torsten Bronger wrote:
Hallöchen!
> And why does this make the implicit insertion of "self" difficult?
I could easily write a preprocessor which does it after all.
class C():
def f():
a = 3
Inserting self into the arg list is trivial. Mindlessly deciding
correctly whether or not to insert 'self.' before 'a' is impossible
when 'a' could ambiguously be either an attribute of self or a local
variable of f. Or do you and/or Jordan plan to abolish local
variables for methods?
Why do you think that 'self' should be inserted anywhere except in the
arg list? AFAIU, the idea is to remove the need to write 'self' in the
arg list, not to get rid of it entirely.
Because you must prefix self attributes with 'self.'. If you do not use
any attributes of the instance of the class you are making the function
an instance method of, then it is not really an instance method and need
not and I would say should not be masqueraded as one. If the function
is a static method, then it should be labeled as one and no 'self' is
not needed and auto insertion would be a mistake. In brief, I assume
the OP wants 'self' inserted in the body because inserting it only in
the parameter list and never using it in the body is either silly or wrong.
tjr
--
http://mail.python.org/mailman/listinfo/python-list