Re: Implementing deepcopy

2005-12-07 Thread Mr.Rech
Thanks for your answer. Since perfomances are not an issue in my case I think I'd stay with copy.copy(). In this way I'm not required to know in advance the object type, and I can implement a __deepcopy__ method for my own classes as follows: >>> def __deepcopy__(self, memo = {}): new

Re: Implementing deepcopy

2005-12-07 Thread Alex Martelli
Mr.Rech <[EMAIL PROTECTED]> wrote: ... > Suppose one of the attributes of my class is a dictionary whose values > are callable functions, such as: > > >>>def foo(): > .pass > >>>def bar(): > .pass > > >>>adict = dict(a = foo, b = bar) > > Now if I try: > > >>> anotherdict = c

Implementing deepcopy

2005-12-07 Thread Mr.Rech
Hi all, I'm writing a class with some attributes which deepcopy can't cope with, and I need some more clarifications. Sorry for my newbie questions, but I'm a newbie indeed (or a sort of). Suppose one of the attributes of my class is a dictionary whose values are callable functions, such as: >>>d