Skip to content
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

Closed
techtonik mannequin opened this issue Mar 22, 2011 · 11 comments
Closed

Cross-link 2to3 documentation, what’s new and pyporting howto #55853

techtonik mannequin opened this issue Mar 22, 2011 · 11 comments
Labels
docs Documentation in the Doc dir

Comments

@techtonik
Copy link
Mannequin

techtonik mannequin commented Mar 22, 2011

BPO 11644
Nosy @ericvsmith, @merwok, @csabella

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:

assignee = None
closed_at = <Date 2019-03-23.20:15:07.644>
created_at = <Date 2011-03-22.23:59:52.671>
labels = ['docs']
title = 'Cross-link 2to3 documentation, what\xe2\x80\x99s new and pyporting howto'
updated_at = <Date 2019-03-23.20:15:07.643>
user = 'https://bugs.python.org/techtonik'

bugs.python.org fields:

activity = <Date 2019-03-23.20:15:07.643>
actor = 'cheryl.sabella'
assignee = 'docs@python'
closed = True
closed_date = <Date 2019-03-23.20:15:07.644>
closer = 'cheryl.sabella'
components = ['Documentation']
creation = <Date 2011-03-22.23:59:52.671>
creator = 'techtonik'
dependencies = []
files = []
hgrepos = []
issue_num = 11644
keywords = []
message_count = 11.0
messages = ['131817', '131818', '131823', '131824', '131827', '131828', '131829', '132137', '338692', '338693', '338696']
nosy_count = 6.0
nosy_names = ['eric.smith', 'techtonik', 'eric.araujo', 'docs@python', 'adam.woodbeck', 'cheryl.sabella']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue11644'
versions = ['Python 3.1', 'Python 2.7', 'Python 3.2', 'Python 3.3']

@techtonik
Copy link
Mannequin Author

techtonik mannequin commented Mar 22, 2011

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'

@techtonik techtonik mannequin added topic-2to3 docs Documentation in the Doc dir labels Mar 22, 2011
@techtonik techtonik mannequin assigned docspython Mar 23, 2011
@merwok
Copy link
Member

merwok commented Mar 23, 2011

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.

@merwok merwok closed this as completed Mar 23, 2011
@merwok merwok added the invalid label Mar 23, 2011
@ericvsmith
Copy link
Member

Plus, it's recommended to move to 2.6 or 2.7 before trying to port to 3.x.

@techtonik
Copy link
Mannequin Author

techtonik mannequin commented Mar 23, 2011

Then the docs should say that this is the 2.6 code, not 2.x

@techtonik
Copy link
Mannequin Author

techtonik mannequin commented Mar 23, 2011

I can't find where it is recommended to move code to Python 2.7 before porting.

@ericvsmith
Copy link
Member

I'll agree that the documentation could mention that. Reopening.

Patches accepted.

@ericvsmith ericvsmith reopened this Mar 23, 2011
@ericvsmith ericvsmith changed the title 2to3 example.py is not a Python 2.x file 2to3 documentation should mention that the sample file requires 2.6 or better Mar 23, 2011
@merwok
Copy link
Member

merwok commented Mar 23, 2011

@merwok
Copy link
Member

merwok commented Mar 25, 2011

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.

@merwok merwok changed the title 2to3 documentation should mention that the sample file requires 2.6 or better Cross-link 2to3 documentation, what’s new and pyporting howto Mar 25, 2011
@csabella
Copy link
Contributor

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!

https://docs.python.org/3.7/howto/pyporting.html

@ericvsmith
Copy link
Member

I agree we should close this.

@csabella
Copy link
Contributor

Thanks, Eric!

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

3 participants