Re: Challenge supporting custom deepcopy with inheritance

2009-06-03 Thread Aahz
In article , Michael H. Goldwasser wrote: >On June 2, 2009, Aahz wrote: >>Michael Goldwasser: >>> >>>class A(object): >>>def __init__(self, aTag): >>>self.__aTag = aTag >>>self.__aList = [] >> >>IMO, your problem starts right here. Not only are you using customized

Re: Challenge supporting custom deepcopy with inheritance

2009-06-03 Thread Michael H . Goldwasser
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

Re: Challenge supporting custom deepcopy with inheritance

2009-06-02 Thread Aahz
In article , Michael H. Goldwasser wrote: > >Assume that class B inherits from class A, and that class A has >legitimately customized its deepcopy semantics (but in a way that is >not known to class B). If we want a deepcopy of B to be defined so >that relevant state inherited from A is copied a

Re: Challenge supporting custom deepcopy with inheritance

2009-06-02 Thread Gabriel Genellina
En Tue, 02 Jun 2009 07:34:43 -0300, Lie Ryan escribió: Gabriel Genellina wrote: En Mon, 01 Jun 2009 14:19:19 -0300, Michael H. Goldwasser escribió: I can examine the inherited slots to see which special methods are there, and to implement my own __deepcopy__ accordingly. But to do so

Re: Challenge supporting custom deepcopy with inheritance

2009-06-02 Thread Scott David Daniels
Michael H. Goldwasser wrote: On Monday June 1, 2009, Scott David Daniels wrote: Michael H. Goldwasser wrote: > I'll accept the "small price for flexibility" that you > note, if necessary. However, I still desire a cleaner solution. You seem to think that "deepcopy" is

Re: Challenge supporting custom deepcopy with inheritance

2009-06-02 Thread Lie Ryan
Gabriel Genellina wrote: > En Mon, 01 Jun 2009 14:19:19 -0300, Michael H. Goldwasser > escribió: > >> I can examine the inherited slots to see which special methods are >> there, and to implement my own __deepcopy__ accordingly. But to do >> so well seems to essentially require reimplementi

Re: Challenge supporting custom deepcopy with inheritance

2009-06-01 Thread Gabriel Genellina
En Mon, 01 Jun 2009 14:19:19 -0300, Michael H. Goldwasser escribió: I can examine the inherited slots to see which special methods are there, and to implement my own __deepcopy__ accordingly. But to do so well seems to essentially require reimplementing the complicated logic of the co

Re: Challenge supporting custom deepcopy with inheritance

2009-06-01 Thread Michael H . Goldwasser
On Monday June 1, 2009, Scott David Daniels wrote: >Michael H. Goldwasser wrote: >> Chris, >> >> Thanks for your well-written reply. Your analogy to the >> complexities of other special methods is well noted. I'll accept >> the "small price for flexibility" that

Re: Challenge supporting custom deepcopy with inheritance

2009-06-01 Thread Scott David Daniels
Michael H. Goldwasser wrote: Chris, Thanks for your well-written reply. Your analogy to the complexities of other special methods is well noted. I'll accept the "small price for flexibility" that you note, if necessary. However, I still desire a cleaner solution. You seem to think th

Re: Challenge supporting custom deepcopy with inheritance

2009-06-01 Thread Michael H . Goldwasser
Chris, Thanks for your well-written reply. Your analogy to the complexities of other special methods is well noted. I'll accept the "small price for flexibility" that you note, if necessary. However, I still desire a cleaner solution. I can examine the inherited slots to see which sp

Re: [Tutor] Challenge supporting custom deepcopy with inheritance

2009-06-01 Thread Gabriel Genellina
En Mon, 01 Jun 2009 00:28:12 -0300, Michael H. Goldwasser escribió: Hi Kent, Thanks for your thoughts. For the original example code, you are correct that we could make it work by having B provide the one-arg constructor to match A's constructor signature. But I don't see this as a general s

Re: [Tutor] Challenge supporting custom deepcopy with inheritance

2009-05-31 Thread Michael H . Goldwasser
Hi Kent, Thanks for your thoughts. For the original example code, you are correct that we could make it work by having B provide the one-arg constructor to match A's constructor signature. But I don't see this as a general solution. Having B.__deepcopy__() make a call to A.__deepcopy__() assu

Challenge supporting custom deepcopy with inheritance

2009-05-30 Thread Michael H . Goldwasser
I've been playing around recently with customizing the deepcopy semantics within an inheritance hierarchy, and run across the following hurdle. Assume that class B inherits from class A, and that class A has legitimately customized its deepcopy semantics (but in a way that is not known to class B