I want to create a function inside a class that replaces itself with a copy of another object of that class. A very rudimentary example is given below, but this seems too manual and imagine it might have other problems like not copying over new methods.
Is there a pythonic way of doing this?
class MyClass:
def __init__(self,a,b):
self.a=a
self.b=b
def Replaceme(self,NewCls):
self.a=NewCls.a
self.b=NewCls.b