On 2016-11-06 00:18, Ram Rachum wrote:
Well, you think it's weird that I want a `finally` clause to not be
called in some circumstances. Do you think it's equally weird to want an
`__exit__` method that is not called in some circumstances?

It's weird to not want the __exit__ to be called if it's defined as a finally block, which is what you're doing with the way you're using contextlib.contextmanager. The __exit__ block there is effectively whatever is after the yield in the generator function you write. If there's code you don't want to always be run, don't put that code inside a finally where the yield is in the try.

Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail."
   --author unknown
Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to