[Python-ideas] "atexit" equivalent for functions in contextlib
Nikolaus Rath
Nikolaus at rath.org
Fri Jan 30 03:28:34 CET 2015
Nick Coghlan <ncoghlan-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> writes:
> On 29 January 2015 at 15:49, Nikolaus Rath <Nikolaus-BTH8mxji4b0 at public.gmane.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?
Nothing. But if that's not a good enough reason, why do we have
contextlib.ContextDecorator?
Best,
-Nikolaus
--
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F
»Time flies like an arrow, fruit flies like a Banana.«
More information about the Python-ideas
mailing list