3 ms·
Cool, I didn't know that could be done. Can it work for global and local variables as well?
by ced 14y ago
Cool, I didn't know that could be done. Can it work for global and local variables as well?
- timClicks 14y agoYou can do anything you want with a context manager, it's just Python. IIRC, they were first added to the language to get rid of boilerplate while acquiring/releasing locks to make multi-threading easier.