Message305952
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. |
|
Date |
User |
Action |
Args |
2017-11-09 10:13:48 | hniksic | set | recipients:
+ 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:48 | hniksic | set | messageid: <1510222428.03.0.213398074469.issue10049@psf.upfronthosting.co.za> |
2017-11-09 10:13:48 | hniksic | link | issue10049 messages |
2017-11-09 10:13:47 | hniksic | create | |
|