Super()

OvermindDL1

18-07-2006 06:10:16

How do I do the equivilent of:
class B(A):
someMethod(self):
super(B, self).someMethod()


Would this be something like what I am looking for:
PyObject_Call(PyObject_GetAttrString(PyObject_Call((PyObject*)(&PySuper_Type), args.ptr(), kw), "__getattribute__"), name.ptr(), kw);

Srekel

18-07-2006 07:25:58

I didn't know there was a super() function in Python. :)

So that was interesting.. but so is this:
http://fuhm.net/super-harmful/

OvermindDL1

18-07-2006 08:21:52

Which does not remove my thinking that it should be used in my circumstance. The C++ class that this is in does inherit from 'object', but it may not be the only inherited class, there are a few others that will be inherited from that have a function name with the same signature (not called from python), ergo, why I am putting this in.

Correct, in most circumstances, it is useless, but not all. For note, the function I am overriding is __getattribute__ due to a state machine setup (working quite well actually).