Contribute Media
A thank you to everyone who makes this possible: Read More

Context Managers: You Can Write Your Own!

Description

Did you know context managers go beyond with open('myfile.txt', 'r') as f? In fact, you can even write your own! Context managers are an amazing tool for managing resources safely. They make your code look great, and they're now easier to write than ever thanks to contextlib! Come get contextual!

Details

Improve this page