New submission from Stepan Wagner: def emptygen(): # Or other more meaningful generator raise StopIteration yield
def wrap(gen): next(gen) print("This should be printed or StopIteration raised.") while True: try: yield next(gen) except StopIteration as exc: return items = wrap(emptygen()) for item in items: print(item) print("End.") ---------- components: Interpreter Core messages: 176939 nosy: Stepan.Wagner priority: normal severity: normal status: open title: Silent StopIteration exc when raised from generator inside of another generator type: behavior versions: Python 2.6, Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16610> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com