Plain context manager



examples/advanced/my_plain_context.py
from contextlib import contextmanager

@contextmanager
def my_plain_context():
    print("start context")
    yield
    print("end context")

print("START")
with my_plain_context():
    print("  In plain context")
    print("  More work")

print("END")

START
start context
  In plain context
  More work
end context
END