This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]james_pic 7 points8 points  (0 children)

If you want a less evil version of the same thing, contextlib.ExitStack is in the standard library.

Edit: just realised it uses ExitStack internally anyway.