[pypy-svn] r72031 - pypy/extradoc/pypy.org/source
arigo at codespeak.net
arigo at codespeak.net
Wed Mar 10 11:34:56 CET 2010
Author: arigo
Date: Wed Mar 10 11:34:55 2010
New Revision: 72031
Modified:
pypy/extradoc/pypy.org/source/compat.txt
Log:
Write the non-with version here too, for people like me
who never got used to the syntax of the with keyword.
Modified: pypy/extradoc/pypy.org/source/compat.txt
==============================================================================
--- pypy/extradoc/pypy.org/source/compat.txt (original)
+++ pypy/extradoc/pypy.org/source/compat.txt Wed Mar 10 11:34:55 2010
@@ -44,7 +44,13 @@
open("filename", "w").write("stuff")
The proper fix is::
-
+
+ f = open("filename", "w")
+ f.write("stuff")
+ f.close()
+
+ or using the ``with`` keyword::
+
with open("filename", "w") as f:
f.write("stuff")
More information about the Pypy-commit
mailing list