summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorFlorian Dahlitz <f2dahlitz@freenet.de>2020-10-20 21:27:07 (GMT)
committerGitHub <noreply@github.com>2020-10-20 21:27:07 (GMT)
commit2d55aa9e37c9c84f4f6a8135d0326da0bcd8f38b (patch)
tree32b2fdc5e25397a54d3648fea8928e16cb9edf6b /Doc/reference
parent5ab27cc518f614a0b954ff3eb125290f264242d5 (diff)
downloadcpython-2d55aa9e37c9c84f4f6a8135d0326da0bcd8f38b.zip
cpython-2d55aa9e37c9c84f4f6a8135d0326da0bcd8f38b.tar.gz
cpython-2d55aa9e37c9c84f4f6a8135d0326da0bcd8f38b.tar.bz2
bpo-29981: Add examples and update index for set, dict, and generator comprehensions'(GH-20272)
Co-authored-by: RĂ©mi Lapeyre <remi.lapeyre@henki.fr>
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/expressions.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index b68c298..81dd6fc 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -162,6 +162,8 @@ ambiguities and allow common typos to pass uncaught.
Displays for lists, sets and dictionaries
-----------------------------------------
+.. index:: single: comprehensions
+
For constructing a list, a set or a dictionary Python provides special syntax
called "displays", each of them in two flavors:
@@ -260,6 +262,7 @@ Set displays
.. index::
pair: set; display
+ pair: set; comprehensions
object: set
single: {} (curly brackets); set expression
single: , (comma); expression list
@@ -287,6 +290,7 @@ Dictionary displays
.. index::
pair: dictionary; display
+ pair: dictionary; comprehensions
key, datum, key/datum pair
object: dictionary
single: {} (curly brackets); dictionary expression