Can't copy iterator object

sebastien s.keim at laposte.net
Fri Oct 26 03:06:54 EDT 2001


>  I'm not supposed to do so? This could be useful...
> 
> Python 2.2b1 (#25, Oct 19 2001, 11:44:52) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> i = iter([1,2,3])
> >>> import copy
> >>> copy.copy(i)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "C:\Python22\lib\copy.py", line 84, in copy
>     y = _reconstruct(x, reductor(), 0)
>   File "C:\Python22\lib\copy_reg.py", line 56, in _reduce
>     state = base(self)
> TypeError: cannot create 'iterator' instances  

I had posted the same question few days before: here are the answers
http://groups.google.com/groups?hl=en&frame=right&th=6499660bd77fd7fc&seekm=7da8d8f8.0110230006.36933486%40posting.google.com#link1

Maybe a potential new entry in the FAQ?



More information about the Python-list mailing list