On 6/28/10 3:09 PM, Edward A. Falk wrote:
In article<mailman.2268.1277736080.32709.python-l...@python.org>,
Stephen Hansen<me+list/pyt...@ixokai.io>  wrote:

Any other use, I basically operate on a file object.

I use file objects all the time.  I use print with them.

The 2to3 conversion script takes care of this for you.

[~]$ 2to3 foo.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
--- foo.py (original)
+++ foo.py (refactored)
@@ -1,3 +1,3 @@
 import sys

-print >>sys.stderr, "Error!"
+print("Error!", file=sys.stderr)
RefactoringTool: Files that need to be modified:
RefactoringTool: foo.py

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to