Hirokazu Yamamoto <ocean-c...@m2.ccsnet.ne.jp> added the comment:

I saw strange thing with following code + release26-maint/trunk.

from itertools import *

class Repeater(object): # this class is similar to itertools.repeat
   def __init__(self, o, t):
       self.o = o
       self.t = int(t)
   def __iter__(self): # its iterator is itself
       return self
   def next(self):
       if self.t > 0:
           self.t -= 1
           return self.o
       else:
           raise StopIteration

r1 = Repeater(1, 3)
r2 = Repeater(2, 4)
for i, j in izip_longest(r1, r2, fillvalue=0):
    print(i, j)

Be care that Repeater is using new-style class. (it's default on py3k) I
couldn't see any problem with officially released windows binary, but I
could see following error with VC6 debug build.

(1, 2)
(1, 2)
(1, 2)
(0, 2)
XXX undetected error
Traceback (most recent call last):
  File "a.py", line 20, in <module>
    print(i, j)
  File "a.py", line 15, in next
    raise StopIteration
StopIteration

# Still there is possibility this is VC6 bug though.

----------
nosy: +ocean-city

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7244>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to