I\'m new to Python and need some advice implementing the scenario below.
I have two classes for managing domains at two different registrars. Both have the same inte
In Python you can change the actual class directly:
class Domain(object):
def __init__(self, domain):
self.domain = domain
if ...:
self.__class__ = RegistrarA
else:
self.__class__ = RegistrarB
And then following will work.
com = Domain('test.com') #load RegistrarA
com.lookup()
I'm using this approach successfully.