I agree that the recursive solution is nice and simple. We've also used it at work. However, you can run into "maximum recursion depth exceeded" issues if the number of context managers is extremely large. ExitStack…
I agree that the recursive solution is nice and simple. We've also used it at work. However, you can run into "maximum recursion depth exceeded" issues if the number of context managers is extremely large. ExitStack…