Is there a way to copy attribute values from the object of base class to the object of derived class?
class Base():
def __init__(self):
self.a = 10
self.b = None
class Derived(Base):
self.c = 30
def main():
base = Base()
base.b = 20
derived = Derived(base)
I tried to find a way more pythonic to copy values of the object of base class since the base class has a number of variables, but I couldn't find a neat way.
I want the variable "derived" to have its value "a = 10 b = 20 c = 30".