Matthew Milano
unread,Aug 3, 2013, 11:17:30 PM8/3/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lamb...@googlegroups.com
Hi everyone,
While reviewing our artifact for submission, one reviewer found a bug in our code.
His test case:
--- start
class MultiCont(object):
def __init__(self, *args):
self.allc = args
def __iter__(self):
for c in self.allc:
for i in c:
print(i)
yield i
# # This works beautifully:
# for i in range(100,107):
# print(i)
m = MultiCont(range(1,7),range(0,3))
# This won't work:
for i in m:
print(i)
--- end
My reduced test case, which still fails (hopefully for similar reasons):
class MultiCont(object):
def __init__(self, arg):
self.allc = arg
def __iter__(self):
print(self.allc)
yield(self.allc)
m = MultiCont('foo')
tmp_iter = iter(m)
tmp_iter.__next__()
I'm seeing this reveal a bug with either generators or iterators, but I'm not sure how to further refine the test to hone in on the nature of this bug. Any ideas from the generator/iterator people?
~matthew