I would like to be able to make sure that any names I add by subclassing do not trample on names already definied by the superclass. Does anybody know how to do this?
class MyFoo( Foo):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# can't test here because mymethod is already defined on self
# can't test here because don't know how to refer to the class being defined
assert not hasattr( ??, 'mymethod')
def mymethod( self):
# but did Foo already have a method or mymethod that I'm trampling on?
...
...