There is a base class Base and a subclass Special.
class Base(object):
def __init__(self, name):
self.name = name
d
actually you can, but I don't think you should. instead of typecasting python has duck-typing to solve this kind of situation.
anyway, here's the code:
>>> base = Base("I'm a base!")
>>> hasattr(base, 'rhyme')
False
>>> base.__class__ = Special
>>> hasattr(base, 'rhyme')
True
>>> base.rhyme()
"Hi I'm a base!! How are you? Fine, thanks. What about you?"