Invoking a subclass's method on its superclass's instance

Lee, Rick rickylee at americasm01.nt.com
Wed Sep 27 12:41:57 EDT 2000


Another potential solution that would solve my problem is to copy all the data
attributes of one class instance to another (in this case from a superclass instance
to subclass instance, and then in the reverse direction later on).  Is this as simple
as the following?

>>> import copy
>>> subclass.__dict__ = copy.deepcopy(superclass.__dict__)




More information about the Python-list mailing list