Explicit Frustration of the Self

Terry Reedy tjreedy at udel.edu
Tue Dec 31 23:24:20 EST 2002


"Sean Ross" <sross at connectmail.carleton.ca> wrote in message
news:uzlQ9.2011$8n5.515861 at news20.bellglobal.com...
> More explicit, in that it is fairly obvious that  you are defining a
method
> that will be called by self,
> as opposed to defining a method that will be passed self as an
argument, as
> the current form suggests.

But of course, the first argument *is* passed as an argument -- which
you can do explicitly if you do not like the usual abbreviated form.
>>> class c:
...   def test(s): print 231
...
>>> ci = c()
>>> c.test(ci)
231

And, of course, calling the first arg 'self' is a convention, not a
commandment.

Terry J. Reedy






More information about the Python-list mailing list