Use empty string for self
John Salerno
johnjsal at NOSPAMgmail.com
Wed Mar 1 11:33:20 EST 2006
Grant Edwards wrote:
> But it _is_ always passed to the function. You can even pass
> it explicity when you call the method if you want:
I meant it isn't always explicitly passed.
>
> #!/usr/bin/python
>
> class MyClass:
> def mymethod(self,p1,p2):
> print self,p1,p2
>
> instance = MyClass()
>
> MyClass.mymethod(instance,1,2)
>
> instance.mymethod(1,2)
>
> The two calls are equivalent.
can you also say instance.mymethod(instance, 1, 2) ?
More information about the Python-list
mailing list