[docs] [issue11248] Tails of generator get lost under zip()
report at bugs.python.org
Sun Feb 20 00:26:13 CET 2011
Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:
This is not a bug. It is an implementation specific detail and is not guaranteed behavior. The submitted "example bug" is horrible code that makes unwarranted assumptions about the implementation -- it is an anti-pattern to write generators that assume that their consumers will run them to exhaustion so that cleanup code will be executed -- a number of tools violate this assumption. If you're relying on this technique for cleanup, you're doing it wrong.
I'll look at this again after the 3.2 release. When it was discussed before, the outcome was to introduce itertools.zip_longest() and to not over-document non-guaranteed implementation specific details (lest people rely on them and write code even worse than the OP's example).
assignee: docs at python -> rhettinger
priority: normal -> low
type: behavior -> feature request
Python tracker <report at bugs.python.org>
More information about the docs