On 2023-11-27, Grant Edwards via Python-list <python-list@python.org> wrote: > On 2023-11-26, Dieter Maurer via Python-list <python-list@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.
I should probably have written "how to fool that <something> into working when he's not using a 'with' statement" -- Grant -- https://mail.python.org/mailman/listinfo/python-list