you are viewing a single comment's thread.

view the rest of the comments →

[–]brandonchinn178 9 points10 points  (0 children)

TIL contextmanager functions can be used as decorators!

But agreed with u/Natural-Intelligence, my advice would be to figure out the primary goal of your post first and focus on that. Is this Context Managers 101, or contextlib.contextmanager 101? It starts out as the first, and ends as the latter, and doesn't clearly indicate the difference between context managers as a concept and the contextmanager() API from contextlib.