I don't agree. Perhaps it was different in 2014-10, but contextlib.contextmanager makes it now quite simple to use a with statement. The only drawback I see is the extra indent, but in the end it is not that significant I find.
Yeah, a context manager and its __exit__ is maybe a good alternative to the `finally:` but it's a mess. I loooove Python but let's admit; Go wins this round :)
Comment
I don't agree. Perhaps it was different in 2014-10, but contextlib.contextmanager makes it now quite simple to use a with statement. The only drawback I see is the extra indent, but in the end it is not that significant I find.
Parent comment
Yeah, a context manager and its __exit__ is maybe a good alternative to the `finally:` but it's a mess. I loooove Python but let's admit; Go wins this round :)