New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cross-link 2to3 documentation, what’s new and pyporting howto #55853
Comments
http://docs.python.org/library/2to3.html#using-2to3 contains an example.py sample which is claimed to be Python 2.x source, but that's not true: def greet(name):
print "Hello, {0}!".format(name)
print "What's your name?"
name = raw_input()
greet(name) The code is valid only for Python 2.6+. For previous versions it gives the following traceback: Traceback (most recent call last):
File "ewe.py", line 5, in <module>
greet(name)
File "ewe.py", line 2, in greet
print "Hello, {0}!".format(name)
AttributeError: 'str' object has no attribute 'format' |
Your title is untrue: This example code from the 2.6 docs is valid 2.6 code. I can’t find a problem with that. |
Plus, it's recommended to move to 2.6 or 2.7 before trying to port to 3.x. |
Then the docs should say that this is the 2.6 code, not 2.x |
I can't find where it is recommended to move code to Python 2.7 before porting. |
I'll agree that the documentation could mention that. Reopening. Patches accepted. |
See also the fifth piece in http://docs.python.org/release/3.2/howto/pyporting#universal-bits-of-advice Resources are here, but lack links. |
Since the HOWTO for Porting from 2 to 3 was created in February 2011, there have been many updates over time to improve that document. It seems to me that it is thorough in its explanation, including the suggestion of upgrading to 2.7 before converting to Python 3. As such, I believe this issue can be closed, but wanted to make sure others agreed before I changed the status. Thanks! |
I agree we should close this. |
Thanks, Eric! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: