Message290916
This issue is related to the behavior of other composite iterators.
>>> from copy import copy
>>> it = map(ord, 'abc')
>>> list(copy(it))
[97, 98, 99]
>>> list(copy(it))
[]
>>> it = filter(None, 'abc')
>>> list(copy(it))
['a', 'b', 'c']
>>> list(copy(it))
[]
The copy is too shallow. If you consume an item from one copy, it is disappeared for the original.
Compare with the behavior of iterators of builtin sequences:
>>> it = iter('abc')
>>> list(copy(it))
['a', 'b', 'c']
>>> list(copy(it))
['a', 'b', 'c']
>>> it = iter(list('abc'))
>>> list(copy(it))
['a', 'b', 'c']
>>> list(copy(it))
['a', 'b', 'c'] |
|
Date |
User |
Action |
Args |
2017-03-31 15:43:45 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, kristjan.jonsson, MSeifert |
2017-03-31 15:43:45 | serhiy.storchaka | set | messageid: <1490975025.22.0.636479345073.issue29897@psf.upfronthosting.co.za> |
2017-03-31 15:43:45 | serhiy.storchaka | link | issue29897 messages |
2017-03-31 15:43:45 | serhiy.storchaka | create | |
|