classification
Title: Tutorial for Continue missing ... line
Type: Stage: patch review
Components: Documentation Versions: Python 3.10, Python 3.9, Python 3.8, Python 3.7, Python 3.6, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Chas Belov, DahlitzFlorian, docs@python, rahul-kumi
Priority: normal Keywords: patch

Created on 2020-05-16 06:02 by Chas Belov, last changed 2020-05-23 22:10 by Chas Belov.

Pull Requests
URL Status Linked Edit
PR 20334 open Chas Belov, 2020-05-23 22:06
Messages (8)
msg369014 - (view) Author: Chas Belov (Chas Belov) * Date: 2020-05-16 06:02
The tutorial code for Continue at https://docs.python.org/3.7/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops is missing a
...
null statement.

Actual code/result:

>>> for num in range(2, 10):
...     if num % 2 == 0:
...         print("Found an even number", num)
...         continue
...     print("Found a number", num)
Found an even number 2
Found a number 3
Found an even number 4
Found a number 5
Found an even number 6
Found a number 7
Found an even number 8
Found a number 9

Expected code/result:

>>> for num in range(2, 10):
...     if num % 2 == 0:
...         print("Found an even number", num)
...         continue
...     print("Found a number", num)
...
Found an even number 2
Found a number 3
Found an even number 4
Found a number 5
Found an even number 6
Found a number 7
Found an even number 8
Found a number 9
msg369570 - (view) Author: Rahul Kumaresan (rahul-kumi) * Date: 2020-05-22 08:49
I think the ommission of secondary prompt(...) at the end of the loop in the code snippet doesn't affect what the example wanted to demonstrate. Even so, if this has to be fixed, this correction is to be done in versions 3.5 through 3.10
msg369580 - (view) Author: Florian Dahlitz (DahlitzFlorian) * Date: 2020-05-22 09:47
@docorbit@sonic.net are you going to submit a PR for it or am I free to do it?
msg369687 - (view) Author: Chas Belov (Chas Belov) * Date: 2020-05-23 02:18
Um, Python newcomer here. What's a PR? Pull request?

I'm happy to do it if you can point me to the how-to. I know my way around git, and not around Python community standards. 

You are also welcome to go ahead and make the change; thank you for asking.
msg369692 - (view) Author: Florian Dahlitz (DahlitzFlorian) * Date: 2020-05-23 05:50
Please go head @docorbit@sonic.net! It's a good one to get familiar with the process of contributing. Yes, PR stands for Pull Request.

There is the devguide (https://devguide.python.org/), which documents how to contribute. In fact, the quick guide may be sufficient. Feel free to ask any further questions, I'm eager to help!
msg369704 - (view) Author: Chas Belov (Chas Belov) * Date: 2020-05-23 08:33
@DahlitzFlorian: I'm happy do to the PR provided I don't actually have to build Python to work on a documentation change. If it does require building Python then please go ahead.

That said, I've looked at the Doc/tutorial/controlflow.rst and it appears to be a plain text file. I believe that I would have a PR up by May 26, 2020. Is the best practice to check out the 3.10 branch then add backport tags for the other versions to the PR? That wasn't clear to me from the docs you referred me to.
msg369720 - (view) Author: Florian Dahlitz (DahlitzFlorian) * Date: 2020-05-23 14:17
I pointed you to the quick guide. In fact, you fork the cpython repository, create a new branch called fix-issue-40640, change the file Doc/tutorial/controlflow.rst and submit a PR agains the cpython master branch. As Rahul as already added all the versions to the issue that need a backport, the cpython bot will handle it for you. So you only need to submit a PR to the master branch. :)
msg369752 - (view) Author: Chas Belov (Chas Belov) * Date: 2020-05-23 22:10
@Florian Dahlitz, thank you for your help. I have created a PR at https://github.com/python/cpython/pull/20334 and it is awaiting approval of my CLA and of the change itself.
History
Date User Action Args
2020-05-23 22:10:56Chas Belovsetmessages: + msg369752
2020-05-23 22:06:27Chas Belovsetkeywords: + patch
stage: patch review
pull_requests: + pull_request19602
2020-05-23 14:17:00DahlitzFloriansetmessages: + msg369720
2020-05-23 08:33:11Chas Belovsetmessages: + msg369704
2020-05-23 05:50:36DahlitzFloriansetmessages: + msg369692
2020-05-23 02:18:35Chas Belovsetmessages: + msg369687
2020-05-22 09:47:55DahlitzFloriansetnosy: + DahlitzFlorian
messages: + msg369580
2020-05-22 08:49:36rahul-kumisetmessages: + msg369570
versions: + Python 3.5, Python 3.6, Python 3.8, Python 3.9, Python 3.10
2020-05-18 16:34:41rahul-kumisetnosy: + rahul-kumi
2020-05-16 06:02:21Chas Belovcreate