Challenge supporting custom deepcopy with inheritance
Michael H. Goldwasser
goldwamh at slu.edu
Wed Jun 3 16:45:07 EDT 2009
On June 2, 2009, Aahz wrote:
> >class A(object):
> > def __init__(self, aTag):
> > self.__aTag = aTag
> > self.__aList = []
>
> IMO, your problem starts right here. Not only are you using customized
> attributes for each class, you're using class-private identifiers. You
> would vastly simplify your work if you switch to single-underscore
> attributes.
Hi Aahz,
I intentionally chose the class-private identifiers in my artificial
example to emphasize that I was looking for a solution in which
class B did not have to rely on particular knowledge of class A's
implementation. That said, switching to single-underscores does not
address the issue raised in the original post.
Michael
More information about the Python-list
mailing list