[Python-Dev] On suppress()'s trail blazing (was Re: cpython: Rename contextlib.ignored() to contextlib.ignore())

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Oct 18 01:35:27 CEST 2013


Guido van Rossum wrote:
> yielding inside "with open(file) as f" 
> seems fine, but yielding inside "with lock" is problematic, since the 
> other side might try to acquire the same lock, and deadlock.

So maybe the documentation of a context manager should
include whether it's safe to yield inside the block.

-- 
Greg


More information about the Python-Dev mailing list