Benjamin Peterson added the comment: Generators exit using GeneratorExit, which you could possible catch. ---------- _______________________________________ Python tracker <report at bugs.python.org> <http://bugs.python.org/issue17468> _______________________________________