[pypy-svn] r72004 - in pypy/extradoc/pypy.org: . source

benjamin at codespeak.net benjamin at codespeak.net
Wed Mar 10 01:17:54 CET 2010


Author: benjamin
Date: Wed Mar 10 01:17:53 2010
New Revision: 72004

Modified:
   pypy/extradoc/pypy.org/compat.html
   pypy/extradoc/pypy.org/source/compat.txt
Log:
use a more modern example

Modified: pypy/extradoc/pypy.org/compat.html
==============================================================================
--- pypy/extradoc/pypy.org/compat.html	(original)
+++ pypy/extradoc/pypy.org/compat.html	Wed Mar 10 01:17:53 2010
@@ -81,9 +81,8 @@
 </pre>
 <p>The proper fix is:</p>
 <pre class="literal-block">
-f = open(&quot;filename&quot;, &quot;w&quot;)
-f.write(&quot;stuff&quot;)
-f.close()
+with open(&quot;filename&quot;, &quot;w&quot;) as f:
+    f.write(&quot;stuff&quot;)
 </pre>
 </li>
 <li><p class="first">We don't support certain attributes that were decided to be

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 01:17:53 2010
@@ -44,10 +44,9 @@
     open("filename", "w").write("stuff")
 
   The proper fix is::
-    
-    f = open("filename", "w")
-    f.write("stuff")
-    f.close()
+  
+    with open("filename", "w") as f:
+        f.write("stuff")
 
 * We don't support certain attributes that were decided to be
   implementation-dependent. For example ``gc.get_referrers``. ``gc.enable``



More information about the Pypy-commit mailing list