summaryrefslogtreecommitdiffstats
path: root/Doc/reference/expressions.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/reference/expressions.rst')
-rw-r--r--Doc/reference/expressions.rst26
1 files changed, 25 insertions, 1 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index e060670..9761f21 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -65,7 +65,7 @@ atoms is:
.. productionlist::
atom: `identifier` | `literal` | `enclosure`
enclosure: `parenth_form` | `list_display`
- : | `generator_expression` | `dict_display`
+ : | `generator_expression` | `dict_display` | `set_display`
: | `string_conversion` | `yield_atom`
@@ -281,6 +281,30 @@ datum (textually rightmost in the display) stored for a given key value
prevails.
+.. _set:
+
+Set displays
+------------
+
+.. index:: pair: set; display
+ object: set
+
+A set display is denoted by curly braces and distinguishable from dictionary
+displays by the lack of colons separating keys and values:
+
+.. productionlist::
+ set_display: "{" (`expression_list` | `comprehension`) "}"
+
+A set display yields a new mutable set object, the contents being specified by
+either a sequence of expressions or a comprehension. When a comma-separated
+list of expressions is supplied, its elements are evaluated from left to right
+and added to the set object. When a comprehension is supplied, the set is
+constructed from the elements resulting from the comprehension.
+
+An empty set cannot be constructed with ``{}``; this literal constructs an empty
+dictionary.
+
+
.. _string-conversions:
String conversions