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

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


Oops, I should have said:

>>> subclassInstance.__dict__ = copy.deepcopy(superclassInstance.__dict__)

to make clear my intensions.

"Lee, Rick" wrote:

> 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