"python -3" not working as expected

Terry Reedy tjreedy at udel.edu
Thu Jan 8 17:04:04 EST 2009


Thorsten Kampe wrote:
> * Marc 'BlackJack' Rintsch (8 Jan 2009 16:26:55 GMT)
>> On Thu, 08 Jan 2009 16:38:53 +0100, Thorsten Kampe wrote:
>>> [Python 2.6.1]
>>>
>>> to test existing Python code, I ran "python -3" ("warn about Python 3.x
>>> incompatibilities") against a test file that only contains "print
>>> 'test'".
>>>
>>> Unfortunately I saw no warnings about print becoming a function in
>>> Python 3 ("print()"). Where is the problem?
>> There is no problem.  ``print``\s are handled fine by the 2to3.py 
>> script.  The option warns about stuff that is not easily automatically 
>> converted.
> 
> There /is/ obviously a problem: the Python command line help[1] and the 
> "Porting To Python 3.0" section of "What’s New In Python 3.0" from Guido 
> van Rossum are misleading (if not to say wrong):
> 
> """
> For porting existing [...] code to Python 3.0, the best strategy is the 
> following:
> [...]
> 2. [...] Turn on the -3 command line switch. This enables warnings about 
> features that will be removed (or change) in 3.0.[...]
> 3. Run the 2to3 source-to-source translator [...]
> """
> 
> Thorsten
> [1] "-3     : warn about Python 3.x incompatibilities"
> --

Since you are, I believe, at least the second person to report being bit 
by this confusion, please open an issue at bugs.python.org and suggest a 
couple of revised sentences that you think are more informative.




More information about the Python-list mailing list