Skip to content

gh-107432 Update Porting Python 2 Code to Python 3 how-to #107434

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

Merged
merged 3 commits into from
Aug 24, 2023

Conversation

evildmp
Copy link
Contributor

@evildmp evildmp commented Jul 29, 2023

https://docs.python.org/3/howto/pyporting.html#porting-python-2-code-to-python-3 was written for another time. In this patch:

  • material that frames Python 3 as "new" is removed
  • descriptions and directions have been trimmed

📚 Documentation preview 📚: https://cpython-previews--107434.org.readthedocs.build/

https://docs.python.org/3/howto/pyporting.html#porting-python-2-code-to-python-3
was written for another time. In this patch:

* material that frames Python 3 as "new" is removed
* descriptions and directions have been trimmed
@bedevere-bot bedevere-bot added awaiting review docs Documentation in the Doc dir skip news labels Jul 29, 2023
@hugovk hugovk added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Jul 29, 2023
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general this feels like it's changing more than necessary. I would treat this mostly as a historical document, and change only things that no longer make sense.

Porting Python 2 Code to Python 3
*********************************
*************************************
How to port Python 2 Code to Python 3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why we need to change the title

Copy link
Contributor Author

@evildmp evildmp Jul 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every genuine how-to guide should have a title "How to <xxx>" to signal clearly what its purpose and scope is.

In menus, the title can be shortened to "<xxx>". Eventually it means you can have a menu that looks like:

How to
    Install
    Deploy
    Scale

etc. So the same clarity of purpose is recapitulated there.

An exception is when it might be clunky to use "how to" - for example I think that "Troubleshooting" is firstly rather less hideous than "How to troubleshoot" and secondly already implies that it's about taking action (in a way that "porting" does not).

"Porting Python 2 Code to Python 3" is ambiguous. Maybe it's not a how-to guide - maybe it's what I should read to find out why I should do that.

If you apply this logic to other documents in that HOWTO section, it becomes clear that many of them cannot be given "How to..." titles - because their content is definitely not how-to content. An example is the functional programming document, which is one that I think should find a different home, for that reason.

Paying close attention to titles is helpful for the clues it gives us about documentation, and sets down good markers for future work.

Co-authored-by: Jelle Zijlstra <[email protected]>
@evildmp
Copy link
Contributor Author

evildmp commented Jul 30, 2023

In general this feels like it's changing more than necessary. I would treat this mostly as a historical document, and change only things that no longer make sense.

If it's a mostly historical document, it should not occupy precious space in the documentation, distracting attention from ones that are relevant. To achieve documentation of quality, nothing should be there that does not perform a useful function.

If it is to stay, it should be maintained.

Copy link
Member

@encukou encukou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a net improvement.
I don't think we should argue if it was a good use of Daniele's time :)
If this needs to be archived, let's do that -- but that's an unrelated decision, really.

@erlend-aasland
Copy link
Contributor

If this needs to be archived, let's do that -- but that's an unrelated decision, really.

IMO, that decision needs a broader audience. FWIW, I'm also in favour of archiving obsolete stuff and/or marking pages as historical.

@hugovk
Copy link
Member

hugovk commented Aug 5, 2023

Let's merge this, and if someone wishes, please open a discussion about archiving at https://discuss.python.org/c/documentation/26.

@encukou encukou merged commit 809ea7c into python:main Aug 24, 2023
@miss-islington
Copy link
Contributor

Thanks @evildmp for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-108409 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 only security fixes label Aug 24, 2023
@bedevere-bot
Copy link

GH-108410 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Aug 24, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 24, 2023
…onGH-107434)

https://docs.python.org/3/howto/pyporting.htmlGH-porting-python-2-code-to-python-3 was written for another time. In this patch:

- material that frames Python 3 as "new" is removed
- descriptions and directions have been trimmed
(cherry picked from commit 809ea7c)

Co-authored-by: Daniele Procida <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 24, 2023
…onGH-107434)

https://docs.python.org/3/howto/pyporting.htmlGH-porting-python-2-code-to-python-3 was written for another time. In this patch:

- material that frames Python 3 as "new" is removed
- descriptions and directions have been trimmed
(cherry picked from commit 809ea7c)

Co-authored-by: Daniele Procida <[email protected]>
Yhg1s pushed a commit that referenced this pull request Aug 24, 2023
…107434) (#108409)

gh-107432 Update Porting Python 2 Code to Python 3 how-to (GH-107434)

https://docs.python.org/3/howto/pyporting.htmlGH-porting-python-2-code-to-python-3 was written for another time. In this patch:

- material that frames Python 3 as "new" is removed
- descriptions and directions have been trimmed
(cherry picked from commit 809ea7c)

Co-authored-by: Daniele Procida <[email protected]>
ambv pushed a commit that referenced this pull request Aug 24, 2023
…107434) (#108410)

https://docs.python.org/3/howto/pyporting.html was written for another time. In this patch:

- material that frames Python 3 as "new" is removed
- descriptions and directions have been trimmed
(cherry picked from commit 809ea7c)

Co-authored-by: Daniele Procida <[email protected]>
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 skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants