After writing class-based and function-based context managers, this lesson compares both of them and names certain trade-offs that might occur.
For more information on context managers, check out Context Managers and Python’s with Statement as either a written tutorial or a video course.
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
mikesult on March 3, 2020
Nice to get an understanding of the context manager protocol and how some of the dunder methods work. Thank you for another great tutorial.