calling class methods as functions
Giorgi Lekishvili
gleki at gol.ge
Tue Apr 9 04:03:04 EDT 2002
Hello!
I wonder if someone explaines tom how can I overcome the following
problem in Python2.0 (I have to use this interpreter):
suppose, we have 2 classes, B, and C.
in class B we have a method "write"
in class C we have a method "write"
def write (self, arg):
import B
res=B.B.write(self, arg) #res is a string being either "ok" or
"failure"
del B
return res
The interpreter gives an error, that class isntance must be given as 1st
argument.
What's wrong?
Thanx,
Giorgi
PS. I know that the best solution is to make a baseclass and put the
method "write" there. Of course. But I would like to know why this
solution fails.
More information about the Python-list
mailing list