Re: The need to put "self" in every method



Fernando M. wrote:

i was just wondering about the need to put "self" as the first
parameter in every method a class has because, if it's always needed,
why the obligation to write it? couldn't it be implicit?

Or is it a special reason for this being this way?

Because it's not always needed. See staticmethod or classmethod.

--
Erik Max Francis && max@xxxxxxxxxxx && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
  The basis of optimism is sheer terror.
  -- Oscar Wilde
.



Relevant Pages

  • Re: The need to put "self" in every method
    ... parameter in every method a class has because, if it's always needed, why the obligation to write it? ... couldn't it be implicit? ... Or is it a special reason for this being this way? ... incompabible change affecting almost every script in existance. ...
    (comp.lang.python)
  • The need to put "self" in every method
    ... why the obligation to write it? ... couldn't it be implicit? ... Or is it a special reason for this being this way? ... Prev by Date: ...
    (comp.lang.python)
  • Re: feliz navidad...pc style?
    ... > Please accept with No Obligation, implied or implicit, my best wishes ... Regards ... at tpg dot com dot au ...
    (alt.usage.english)
  • Re: The need to put "self" in every method
    ... >why the obligation to write it? ... couldn't it be implicit? ... Didn't this exact question get asked just a few days ago? ... like prepending m_ to member names (except that ...
    (comp.lang.python)