Context without manager

Grant Edwards grant.b.edwards at gmail.com
Sun Nov 26 22:43:53 EST 2023


On 2023-11-26, Dieter Maurer via Python-list <python-list at python.org> wrote:

> If you do not have this case (e.g. usually if you open the file
> in a class's `__init__`), you do not use a context manager.

He knows that. The OP wrote that he wants to use <something> that can
_only_ be used by a context manager, but he wants that usage to be
spread over various methods of a class he's writing.  So he's asking
how to fool that <something> into working when he's not using a
context manager.

--
Grnat






More information about the Python-list mailing list