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

Aahz Maruch aahz at netcom.com
Wed Jun 30 16:39:30 EDT 1999


In article <19990630222121.A1121 at optiplex.palga.uucp>,
Gerrit Holl  <gerrit.holl at pobox.com> wrote:
>
>I never saw code where the first argument of a method wasn't self. Is it
>in theory possible?

Yes and no.  The first argument always *is* self, but it can be named
something else.  For example:

class foo :
	def bar(s):
		s.bar()  # recursive call
--
                      --- Aahz (@netcom.com)

Hugs and backrubs -- I break Rule 6       <*>      http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het




More information about the Python-list mailing list