Hrvoje Nikšić <hnik...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue10049>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to