3 ms·
Python's context managers have that; define the two sides of the functionality in __enter__()/__exit__(), and voila. C#'s IDIsposable has this, too. So do oth
by ubernostrum 15y ago
Python's context managers have that; define the two sides of the functionality in __enter__()/__exit__(), and voila.
C#'s IDIsposable has this, too.
So do other languages. It's really not that unusual a pattern.