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>
This commit is contained in:
Florian Dahlitz 2020-10-20 23:27:07 +02:00 committed by GitHub
parent 5ab27cc518
commit 2d55aa9e37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 0 deletions

View file

@ -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