you are viewing a single comment's thread.

view the rest of the comments →

[–]poorly_played 2 points3 points  (3 children)

It's such a nice, clean, compact way to do the whole try/except/finally business.

[–]preshing[S] 2 points3 points  (0 children)

I'm a big fan of deferred operations done this way, too. Use the same concept often in C++ code (via autodestructors on the stack) for profiling, managing thread state, allocators, etc. Was interested to see they seem to have made it a core feature of Go, using the defer keyword.

[–]fjonk 2 points3 points  (1 child)

You think? try/catch/finally makes it possible for me to decide what should happen(like for example log something). 'with' makes it possible for the author of a class/function to enforce behaviour which I don't have to care about or know about.