class Ctx:
def __enter__(self):
pass
with Ctx() as ctx:
pass
class Ctx:
def __enter__(self):
pass
def __exit__(self, *exc):
pass
with Ctx() as ctx:
pass
Used when an instance in a with statement doesn’t implement the context
manager protocol(__enter__
/__exit__
).