Virtual function in Python class
class SpecialCase: def amethod(self): print "special" class NormalCase: def amethod(self): print "normal" def appropriateCase(isnormal=1): if isnormal: return NormalCase() else: return SpecialCase() aninstance = appropriateCase(isnormal=0) aninstance.amethod()