In brief, I'm trying to get a 'virtual class' thing going so that I can use it for generic Toplevel widgets whose behavior is specified by the inheriting class.
I have this code (Pyth. 2.4):
class Generic: def __init__(self): self.field = "hi" # placeholder def gen_method(self): self.method() # I'm hoping that this can be defined by the child class Specific1(Generic): def __init__(self): super(Specific1,self).__init__() def method(): # defining here... print "Specific1 method!" class Specific2(Generic): def __init__(self): super(Specific2,self).__init__() def method(): # and here... print "Specific2 method!" a = Specific1() b = Specific2() a.gen_method() b.gen_method()
Surprisingly, the code never gets out of the gate. Instead, I get:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in -toplevel-
TypeError: super() argument 1 must be type, not classobj
If I take this at face value, it appears to mean that super(int) is valid, but super(MyInheritedClass) is not ... which is contrary to what the help docs say.
Thanks in advance,