@@ -1 +1,2 @@ -open(path, "w").write("my bad data I don't care about") +with open(path, "w") as f: + f.write("my super great data") Wednesday, September 4, 13
+1,3 @@ -conn.execute("SELECT bad from cpython") +from contextlib import closing +with closing(conn.cursor()) as cursor: + cursor.execute("SELECT awesome FROM pypy") Wednesday, September 4, 13