[issue5577] yield in iterators

2009-03-27 Thread qwjqwj
qwjqwj added the comment: Ok, I see. Thanks. However, I don't think yield should be consumed at the iterator's level. It may be more useful for the outside function to consume the yield. For example, some function want to change some data with another "thread". def f(

[issue5577] yield in iterators

2009-03-27 Thread qwjqwj
qwjqwj added the comment: More experiments: The tuple pair (10,20) don't correspond to (i,i*i) The yield order is distorted >>> x = (((yield i),(yield i*i)) for i in range(3)) >>> x.__next__() 0 >>> x.send(10) 0 >>> x.send(20) (10, 20) >>> x.

[issue5577] yield in iterators

2009-03-27 Thread qwjqwj
qwjqwj added the comment: >>> x = {(yield i) for i in range(10)} >>> x at 0x02A453F0> >>> list(x) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, {None}] -- ___ Python tracker <

[issue5577] yield in iterators

2009-03-27 Thread qwjqwj
qwjqwj added the comment: >>> x = ((yield i) for i in range(10)) >>> list(x) [0, None, 1, None, 2, None, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, 9, None] -- ___ Python tracker <http://bugs

[issue5577] yield in iterators

2009-03-27 Thread qwjqwj
qwjqwj added the comment: Why should yield can be put inside the iterator? The behavior here is very weired. >>> x = [(yield i) for i in range(10)] >>> print(list(x)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, [None, None, None, None, None, None, None

[issue5577] yield in iterators

2009-03-27 Thread qwjqwj
New submission from qwjqwj : In Python 3.0,3.1a1: >>> def f(): [(yield i) for i in range(10)] >>> f() >>> f() is None True >>> def f(): ((yield i) for i in range(10)) >>> f() >>> f() is None True However it is correct in Py

[issue5345] cStringIO class name typo

2009-02-21 Thread qwjqwj
qwjqwj added the comment: This bug also exists in Python 2.6.1 ___ Python tracker <http://bugs.python.org/issue5345> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue5345] cStringIO class name typo

2009-02-21 Thread qwjqwj
New submission from qwjqwj : It has a typo error in cStringIO.StringIO's class name "StringO": >>> import cStringIO >>> a=cStringIO.StringIO() >>> a >>> a.__class__.__name__ 'StringO' So we can't unpickle the object correctly w

[issue5328] Crash when doing some list iteration

2009-02-21 Thread qwjqwj
qwjqwj added the comment: I used the script from issue 4732 and can reproduce segfault on my RHEL 5. After that I updated the system with "yum update" and get a new version of libc. Currently the script cannot cause segfault after updating. Thank you for

[issue5328] Crash when doing some list iteration

2009-02-20 Thread qwjqwj
New submission from qwjqwj : I am using the python 2.5.4 in redhat enterprise. My project is a big one with turbogears and sqlobject. The python core dumped sometime when iterating list. It occurs randomly and cannot be reproduced. After using gdb, I found python core dumped at this line in