I'm using ver 0.7 (downloaded it from SourceForge, I think)
I've had problems creating subclasses of StringCol (my
goal is to make the columns able to return GUI
components based on their type). My class definitions
look like this:
class NewChild(StringCol, SomeGUIMixIn):
The problem is: The constructor of SomeGUIMixIn (and
its superclasses) are never called by this statement.
I've searched the web looking for similar problems, and
it seems that this is related to the way super() works
with multiple inheritance. In my class declaration, it
wold start by calling the constructor of the leftmost
superclass (i.e. StringCol), go down it's entire
inheritance tree to object, and then proceed to the
next superclass in the definition (in this example
SomeGUIMixIn) and go down that tree to object. The
problem occurs if some superclass forgets to call the
one of it's own superclass's constructors. Then the
chain is broken, and no more constructors will be called.
It seems to me that this is the problem here. I checked
the source code availible via the API, and Col, a
direct subclass of object, never seems to call
object.__init__() (or the equivalent "super(Col,
self).__init__()"). This should be easy to fix? (my
suspicion is strengthened by the fact that if I reverse
the order of the superclasses of NewChild in it's
declaration to "class NewChild(SomeGUIMixIn,
StringCol)", at least my constructor in SomeGUIMixIn
and it's superclasses are called.
Please correct me if I'm wrong! I'm not experienced
Jostein Bø Fløystad
Log in to post a comment.