I strongly dislike Python 3

Robert Kern robert.kern at gmail.com
Mon Jun 28 17:11:51 EDT 2010


On 6/28/10 3:09 PM, Edward A. Falk wrote:
> In article<mailman.2268.1277736080.32709.python-list at python.org>,
> Stephen Hansen<me+list/python at 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




More information about the Python-list mailing list