"python -3" not working as expected
Thorsten Kampe
thorsten at thorstenkampe.de
Thu Jan 8 16:39:18 EST 2009
* 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"
More information about the Python-list
mailing list