[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-28 Thread Mark Dickinson
Mark Dickinson added the comment: Opened https://bugs.pypy.org/issue1355 for this. -- ___ Python tracker ___ ___ Python-bugs-list mail

[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-28 Thread Mark Dickinson
Mark Dickinson added the comment: And here's a non-infinite example where CPython and PyPy differ. Python 2.7.3 |EPD 7.3-1 (32-bit)| (default, Apr 12 2012, 11:28:34) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "credits", "demo" or "enthought" for more information. >>> b = [1] >>> b += (x

[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-28 Thread Mark Dickinson
Mark Dickinson added the comment: It looks to me as though this has nothing to do with itertools In CPython 2.7: Python 2.7.3 |EPD 7.3-1 (32-bit)| (default, Apr 12 2012, 11:28:34) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "credits", "demo" or "enthought" for more information. >>> b =

[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-28 Thread R. David Murray
R. David Murray added the comment: If it is a feature, then is it documented in the language reference and is this actually a bug in PyPy (it sounds like it is)? -- ___ Python tracker _

[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: This isn't a bug. It is an intended feature that chain.from_iterable evaluates lazily (and is documented as such). The pure python equivalent in the docs behaves the same as the C version does. Also, it is a long standing feature of lists that you can loo

[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-27 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-27 Thread R. David Murray
R. David Murray added the comment: Yes, the behavior here is "undefined" at the language level. And as pyos says, technically it is documented: if you mutate the object over which you are iterating inside the iteration context (a for loop is just one example of same), the behavior is explicit

[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-27 Thread pyos
pyos added the comment: I don't think this is a bug. `b += iter(b)` and `for c in b: b.append(c)` work the same way. Also, the tutorial makes it clear that you should duplicate the list if you modify it inside a loop; in this case, this can be done either by iterating over `b[:]` instead of ju

[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-27 Thread Danilo Bargen
Changes by Danilo Bargen : -- nosy: +gwrtheyrn ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-27 Thread David Halter
New submission from David Halter: The following lines run infinitely: b = [1] import itertools b += itertools.chain.from_iterable([c] for c in b) In my opinion this is a bug. Clearly you could say that this is an implementation detail. But afaik this is not documented and very misleading. BTW