Is there a library method to copy all the properties between two (already present) instances of the same class, in Python?
I mean, something like Apache Commons\'
If you have to do this, I guess the nicest way is to have a class attribute something like :
Class Copyable(object):
copyable_attributes = ('an_attribute', 'another_attribute')
Then iterate them explicitly and use setattr(new, attr, getattr(old, attr)). I still believe it can be solved with a better design though, and don't recommend it.