[Python-ideas] "atexit" equivalent for functions in contextlib

Nick Coghlan ncoghlan at gmail.com
Thu Jan 29 12:49:58 CET 2015


On 29 January 2015 at 15:49, Nikolaus Rath <Nikolaus at rath.org> wrote:
> It's not a lot of code, but my feeling is that not anyone who might be
> interested in an "on_return" functionality would be able to come up with
> this right away.

What does it gain you other than saving a level of indentation over
the form with an explicit context manager?

The version with the magic hidden wrapper will also be slower than the
explicit form, and will break parameter prompting in most IDEs.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list