Returning generators from with statements

Christian Aichinger
Thu, 12 Nov 2015 00:00:00 +0100
blog, python

Returning a Python generator from a with statement produces unexpected behavior: the generator executes after the end of the with block. Look out!