Nov-14-2016, 09:47 PM
I think this is what you want:
class Base(object): def f(self): raise NotImplementedError() @classmethod def has_f(cls): return cls.f != Base.f class Derived(Base): def f(self): pass class Inherit(Base): def g(self): pass if __name__ == '__main__': print(Base.has_f()) print(Derived.has_f()) print(Inherit.has_f())This returns True if the method has been overridden. The classmethod decorator makes the class be passed as the first parameter, not the instance.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures