The need to put "self" in every method

Steve Holden steve at holdenweb.com
Tue May 31 12:06:44 EDT 2005


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/




More information about the Python-list mailing list