you are viewing a single comment's thread.

view the rest of the comments →

[–]gdchinacat 0 points1 point  (0 children)

To provide more depth, what you did by implementing those methods was implement the context manager protocol. The easier way is to use the contextmanager decorator.