On 11/6/2016 2:18 AM, 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?
Without a deeper understanding of why you want to do so, I would. The automatic exit cleanup typically the main purpose of a context manager and 'with' block. If, for instance, I want a file only maybe closed, I would just call 'open' instead of 'with open' and then conditionally (with 'if' or 'try') call 'close'.
-- Terry Jan Reedy _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/