The need to put "self" in every method

Erik Max Francis max at alcyone.com
Tue May 31 12:46:20 EDT 2005


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 at alcyone.com && 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



More information about the Python-list mailing list