Message7530
This might be limited to the itertools library, as I was not able to reproduce this using freeform iterator objects...nonetheless this is pretty core.
Propagation of iterator objects, at least in the case of itertools.chain(), appears to be broken:
from itertools import chain
class MyClass(object):
def __iter__(self):
return chain([1, 2, 3])
my_obj = MyClass()
print list(my_obj) # python prints [1,2,3], jython prints []
chain_obj = my_obj.__iter__()
assert list(chain_obj) == list(my_obj)
Above, the "chain()" object returned by my_obj.__iter__() works fine and yields [1,2,3], however when my_obj itself is called in an iterator context, the iterator yields nothing. The assertion at the end fails on Jython and passes on cPython. |
|
Date |
User |
Action |
Args |
2012-11-19 17:47:25 | zzzeek | set | recipients:
+ zzzeek |
2012-11-19 17:47:25 | zzzeek | set | messageid: <1353347245.59.0.874810035256.issue1991@psf.upfronthosting.co.za> |
2012-11-19 17:47:25 | zzzeek | link | issue1991 messages |
2012-11-19 17:47:25 | zzzeek | create | |
|