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



Fernando M. wrote:
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?

Thanks.

The reason can be found in the output from the python statement "import this". Explicit is better than implicit.

regards
 Steve
--
Steve Holden        +1 703 861 4237  +1 800 494 3119
Holden Web LLC             http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/

.



Relevant Pages

  • 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
    ... Fernando M. schrieb: ... parameter in every method a class has because, if it's always needed, why the obligation to write it? ... couldn't it be implicit? ...
    (comp.lang.python)
  • Re: The need to put "self" in every method
    ... Fernando M. wrote: ... parameter in every method a class has because, if it's always needed, why the obligation to write it? ... Explicit is better than implicit. ...
    (comp.lang.python)
  • Re: Logon Group Policies
    ... Regards to all, ... >> which happens to be Internet Explorer but I only ... >> belongs to this OU and I am configuring the group policies for this OU in ... >> Fernando. ...
    (microsoft.public.windows.server.active_directory)
  • 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)