http://code.google.com/p/python-hidden-markov/source/browse/trunk/Markov.py
Contains a class HMM, which inherits from BayesianModel, which is a new-style class. Each has a __call__ method. HMM‘s __call__ method is meant to invoke BayesianModel’s at line 227:
return super(HMM,self)(PriorProbs)
However, this fails with an exception
super(HMM,self)
is not callable.
What am I doing wrong?
You need to invoke the
__call__method itself, explicitly:This applies to any hook that needs to call the overridden method on the superclass.
super()returns a proxy object, with a.__getattribute__()method that searches the super-class hierarchy for the attribute you are searching for. This proxy itself is not callable; it has no__call__method of it’s own. Only when you explicitly look up the__call__method as an attribute of that proxy can python find the right implementation for you.