this is the code.
class Animal(object):
def __init__(self):
self.alive = "alive"
self.good = "good"
self.eyecolor = "varys"
sally = Animal()
sally.eyecolor = "brown"
class Canine(Animal):
def __init__(self):
super(Canine,self).__init__()
self.legs = 4
self.fur = "everywhere"
sally = Canine()
print(sally.eyecolor)
So in this scenario, I have a class, and an object constructed by it, sally. Now I have a new class, Canine I would like to move sally into. Is there a way I can move sally into the Canine class so she retains her original eyecolor?
I am aware I can just do sally.eyecolor = "brown" again, however, in the real problem I have many more attributes and doing that for each is cumbersome.
I was thinking copy.deepcopy(sally), but I'm not sure how I would then put her through a class instance to inherit the new class.