how to give an object as argument for a method
Greg Ewing
greg at cosc.canterbury.ac.nz
Thu Mar 7 21:08:12 EST 2002
Marco Herrn wrote:
>
> If a have a method with the defininion 'f(self)' I call this method only
> with 'f()'. So the declaration doesn't look the same like the call.
There are times where you *do* explicitly pass
in self, mainly when calling inherited methods,
e.g.
class C(D):
def __init__(self):
...
D.__init__(self) # Initialise my base class
...
So if "self" were implicit, then *this* would be
a case where the call didn't match the definition.
You can't win!
--
Greg Ewing, Computer Science Dept, University of Canterbury,
Christchurch, New Zealand
To get my email address, please visit my web page:
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list