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>
(cherry picked from commit 2d55aa9e37c9c84f4f6a8135d0326da0bcd8f38b)
Co-authored-by: Florian Dahlitz <f2dahlitz@freenet.de>
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index f1f19c3..938a973 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -162,6 +162,8 @@
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 @@
.. index::
pair: set; display
+ pair: set; comprehensions
object: set
single: {} (curly brackets); set expression
single: , (comma); expression list
@@ -287,6 +290,7 @@
.. index::
pair: dictionary; display
+ pair: dictionary; comprehensions
key, datum, key/datum pair
object: dictionary
single: {} (curly brackets); dictionary expression