[Python-checkins] cpython (merge 3.2 -> default): merge from 3.2

senthil.kumaran python-checkins at python.org
Sun Aug 12 21:15:50 CEST 2012


http://hg.python.org/cpython/rev/dd41c287cf7c
changeset:   78538:dd41c287cf7c
parent:      78534:bae08aad33cf
parent:      78537:e855e6c26dfb
user:        Senthil Kumaran <senthil at uthcode.com>
date:        Sun Aug 12 12:13:38 2012 -0700
summary:
  merge from 3.2

Issue #15630: Add an example for "continue" statement in the tutorial. Patch by
Daniel Ellis.

files:
  Doc/tutorial/controlflow.rst |  19 ++++++++++++++++---
  Misc/NEWS                    |  16 ++++++++++++++++
  2 files changed, 32 insertions(+), 3 deletions(-)


diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst
--- a/Doc/tutorial/controlflow.rst
+++ b/Doc/tutorial/controlflow.rst
@@ -157,9 +157,6 @@
 The :keyword:`break` statement, like in C, breaks out of the smallest enclosing
 :keyword:`for` or :keyword:`while` loop.
 
-The :keyword:`continue` statement, also borrowed from C, continues with the next
-iteration of the loop.
-
 Loop statements may have an ``else`` clause; it is executed when the loop
 terminates through exhaustion of the list (with :keyword:`for`) or when the
 condition becomes false (with :keyword:`while`), but not when the loop is
@@ -194,6 +191,22 @@
 occurs. For more on the :keyword:`try` statement and exceptions, see
 :ref:`tut-handling`.
 
+The :keyword:`continue` statement, also borrowed from C, continues with the next
+iteration of the loop::
+
+    >>> for num in range(2, 10):
+    ...     if x % 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
 
 .. _tut-pass:
 
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -13,6 +13,22 @@
 Library
 -------
 
+C API
+-----
+
+Extension Modules
+-----------------
+
+Tools/Demos
+-----------
+
+Documentation
+-------------
+
+- Issue #15630: Add an example for "continue" stmt in the tutorial. Patch by
+  Daniel Ellis.
+
+
 
 What's New in Python 3.3.0 Beta 2?
 ==================================

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list