[Python-checkins] bpo-40552 Add 'users' variable in code sample (tutorial 4.2). (GH-19992)
Antoine
webhook-mailer at python.org
Fri May 22 20:29:42 EDT 2020
https://github.com/python/cpython/commit/6fad3e6b49f6a9f8b8a6635c41371e4451479f86
commit: 6fad3e6b49f6a9f8b8a6635c41371e4451479f86
branch: master
author: Antoine <43954001+awecx at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-05-22T21:29:34-03:00
summary:
bpo-40552 Add 'users' variable in code sample (tutorial 4.2). (GH-19992)
* Add 'users' variable in code sample.
* 📜🤖 Added by blurb_it.
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
files:
A Misc/NEWS.d/next/Documentation/2020-05-09-12-10-31.bpo-40552._0uB73.rst
M Doc/tutorial/controlflow.rst
diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst
index f05f5edd5ccc4..26de866aab90c 100644
--- a/Doc/tutorial/controlflow.rst
+++ b/Doc/tutorial/controlflow.rst
@@ -70,6 +70,9 @@ Code that modifies a collection while iterating over that same collection can
be tricky to get right. Instead, it is usually more straight-forward to loop
over a copy of the collection or to create a new collection::
+ # Create a sample collection
+ users = {'Hans': 'active', 'Éléonore': 'inactive', '景太郎': 'active'}
+
# Strategy: Iterate over a copy
for user, status in users.copy().items():
if status == 'inactive':
diff --git a/Misc/NEWS.d/next/Documentation/2020-05-09-12-10-31.bpo-40552._0uB73.rst b/Misc/NEWS.d/next/Documentation/2020-05-09-12-10-31.bpo-40552._0uB73.rst
new file mode 100644
index 0000000000000..5ed9c31834ac2
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2020-05-09-12-10-31.bpo-40552._0uB73.rst
@@ -0,0 +1,2 @@
+Fix in tutorial section 4.2.
+Code snippet is now correct.
\ No newline at end of file
More information about the Python-checkins
mailing list