On Thu, 16 Jul 2009 18:08:45 -0700, Chris Rebert wrote:
> You're trying to call an instance method on the class itself, which
> doesn't make sense.
Oh I don't know, people do it all the time -- just not the way the OP
did :)
> You need to first create an instance of the class to invoke the method
> on. i.e.:
>
> instance = TheClass(constuctor_arguments_here)
> var1 = instance.method()
Or explicitly pass an instance to the method when calling from the class:
TheClass.method(TheClass(constuctor_arguments_here))
Which strangely enough, is useful at times.
class K(parent):
def method(self, args):
x = parent.method(self, args)
return x + 1
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list