Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0e4b4c58
Commit
0e4b4c58
authored
Sep 21, 2008
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#3917: don't allow {} as a set display.
parent
b1ae725b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
14 deletions
+3
-14
Doc/reference/expressions.rst
Doc/reference/expressions.rst
+3
-14
No files found.
Doc/reference/expressions.rst
View file @
0e4b4c58
...
...
@@ -223,7 +223,7 @@ 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`]
"}"
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
...
...
@@ -231,19 +231,8 @@ 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.
Variables used in the generator expression are evaluated lazily in a separate
scope when the :meth:`next` method is called for the generator object (in the
same fashion as for normal generators). However, the :keyword:`in` expression
of the leftmost :keyword:`for` clause is immediately evaluated in the current
scope so that an error produced by it can be seen before any other possible
error in the code that handles the generator expression. Subsequent
:keyword:`for` and :keyword:`if` clauses cannot be evaluated immediately since
they may depend on the previous :keyword:`for` loop. For example:
``(x*y for x in range(10) for y in bar(x))``.
The parentheses can be omitted on calls with only one argument. See section
:ref:`calls` for the detail.
An empty set cannot be constructed with ``{}``; this literal constructs an empty
dictionary.
.. _dict:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment