From: Python-list <[email protected]> on behalf of Rob Gaddi <[email protected]> Sent: Thursday, March 15, 2018 12:47 PM To: [email protected] Subject: Re: Context manager on method call from class > from contextlib import contextmanager. > > Then you just use the @contextmanager decorator on a function, have it > set up, yield the context you want, and clean up after.
Nice, all of what I wrote replaced with three lines:) Thank you, jlc -- https://mail.python.org/mailman/listinfo/python-list
