bpo-10049: Add a "no-op" (null) context manager to contextlib (GH-4464)

Adds a simpler and faster alternative to ExitStack for handling
single optional context managers without having to change the
lexical structure of your code.
This commit is contained in:
Jesse-Bakker 2017-11-23 01:23:28 +01:00 committed by Nick Coghlan
parent 20d48a44a5
commit 0784a2e5b1
4 changed files with 57 additions and 19 deletions

View file

@ -0,0 +1,3 @@
Added *nullcontext* no-op context manager to contextlib. This provides a
simpler and faster alternative to ExitStack() when handling optional context
managers.