[Python-Dev] RE: cloning iterators again

Guido van Rossum guido at python.org
Wed Oct 29 10:58:53 EST 2003


> This is a quite deep problem, actually. I admit I have never used
> copy.py because in all cases I needed more control about what should
> be copied or not.  This generator-copier module that we are talking
> about is no exception: its existence is not only due to the fact
> that it can copy generators, but also that I needed precise control
> over what I copied and what I shared.  Putting this information in
> __getstate__ or __copy__ methods of instances or in copy_reg only
> goes so far, because sometimes you want to do different things with
> the same instances in the same program -- e.g. you may want at some
> point only a copy of a small number of objects (e.g. to be able to
> rollback a small transaction), and at some other point a more
> complete copy of the state of the same program.
> 
> Nevertheless, I can surely make a C module that registers in
> copy_reg a deep copier for generators.

I'm not sure that there would be a general use for this...

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list