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



"Fernando M." <fernandomirandamuro@xxxxxxxxx> wrote in message news:1117554344.938440.54700@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

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?

There are two different issues.

1. If self was made a keyword, there would be no need for
it in the method header. However, that would be a major
incompabible change affecting almost every script in existance.
Also some people use other words than self. (It would,
by the way, result in a performance improvement.)

2. There's been some talk of making the '.' operator allow an
implied instance. I'm not sure what the status of this is.

These two are actually separate issues; either could be
done without the other.

John Roth

Thanks.


.



Relevant Pages

  • 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: 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? ... The basis of optimism is sheer terror. ...
    (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)