This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hniksic
Recipients Albert.Zeyer, Alexander.Jones, DLitz, Martin Blais, blais, daniel.urban, eric.araujo, georg.brandl, giampaolo.rodola, hniksic, michael.foord, ncoghlan, piotr.dobrogost, pitrou, r.david.murray, rhettinger, vstinner
Date 2017-11-09.10:13:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1510222428.03.0.213398074469.issue10049@psf.upfronthosting.co.za>
In-reply-to
Content
For what it's worth, we are still using our own null context manager function in critical code. We tend to avoid contextlib.ExitStack() for two reasons:

1) it is not immediately clear from looking at the code what ExitStack() means. (Unlike the "contextmanager" decorator, ExitStack is unfamiliar to most developers.)

2) ExitStack's __init__ and __exit__ incur a non-negligible overhead compared to a true do-nothing context manager.

It doesn't surprise me that projects like Tensor Flow introduce their own versions of this decorator. Having said that, I can also understand why it wasn't added. It is certainly possible to live without it, and ExitStack() is a more than acceptable replacement for casual use.
History
Date User Action Args
2017-11-09 10:13:48hniksicsetrecipients: + hniksic, georg.brandl, rhettinger, blais, ncoghlan, pitrou, vstinner, giampaolo.rodola, eric.araujo, r.david.murray, michael.foord, daniel.urban, Albert.Zeyer, piotr.dobrogost, Alexander.Jones, DLitz, Martin Blais
2017-11-09 10:13:48hniksicsetmessageid: <1510222428.03.0.213398074469.issue10049@psf.upfronthosting.co.za>
2017-11-09 10:13:48hniksiclinkissue10049 messages
2017-11-09 10:13:47hniksiccreate