New submission from Sven Rahmann <svenrahm...@googlemail.com>: Lists from list comprehensions and generator objects from generator expressions behave differently when we repeatedly want to iterate over them.
This may or may not be a bug, but it is certainly not clear from the documentation (see documentation of "for" statement in all recent python versions). The reason seems to be that generator expressions, once exhausted, are not reset by using them again in a for loop. This is different for lists and range objects. The attached example illustrates the phenomenon. It is written for Python 3, but the same phenomenon occurs in the 2.x series. ---------- files: generatorbug1.py messages: 87440 nosy: svenrahmann severity: normal status: open title: Generator expression bug? type: behavior versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1 Added file: http://bugs.python.org/file13923/generatorbug1.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5968> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com