Does the first argument of a method *has to be* self?

Johan Wouters johanw at easics.be
Thu Jul 1 06:09:33 EDT 1999


Gerrit Holl wrote:
> 
> Hello,
> 
> I never saw code where the first argument of a method wasn't self. Is it
> in theory possible?

As one thinks about it, the first argument being self (the instance)
is a handy feature. Why would you want to put it somewhere else?

As the documentation states "self" is just some conventional name.
Renaming self into something else is probably a bad idea as it
will make your code less readable for others (and YOU as time passes!).

Experience shows that having conventions is a powerful way to
make life and code maintenance easier.

Kind regards,
===================================================================
Johan Wouters             ===              Easics               ===
ASIC Designer             ===  System-on-Chip design services   ===
Tel: +32-16-395 616          ===================================
Fax: +32-16-395 619      Interleuvenlaan 86, B-3001 Leuven, BELGIUM
mailto:johanw at easics.be           http://www.easics.com




More information about the Python-list mailing list