Context Managers FTW
In their most basic form, Python's context managers make it easier to do the right thing by getting rid of some boiler-plate. For example, it was sometimes tempting to skip the try/finally to close a file object correctly, since Python would usually clean it up anyways when it went out of scope. But it's much easier to do it right this way:
with open('filename') as fp:
contents = fp.read()
instead of this way:
fp = open('filename')
try:
contents = fp.read()
finally:
fp.close()
However, the more I work with context managers, the more they change the ...