Commit 89b03b0e authored by Ezio Melotti's avatar Ezio Melotti

Rephrase a sentence in the set and dict comprehensions tutorial page.

parent e4b86398
...@@ -413,7 +413,7 @@ with no duplicate elements. Basic uses include membership testing and ...@@ -413,7 +413,7 @@ with no duplicate elements. Basic uses include membership testing and
eliminating duplicate entries. Set objects also support mathematical operations eliminating duplicate entries. Set objects also support mathematical operations
like union, intersection, difference, and symmetric difference. like union, intersection, difference, and symmetric difference.
Curly braces or the :func:`set` function can be used to create sets. Note: To Curly braces or the :func:`set` function can be used to create sets. Note: to
create an empty set you have to use ``set()``, not ``{}``; the latter creates an create an empty set you have to use ``set()``, not ``{}``; the latter creates an
empty dictionary, a data structure that we discuss in the next section. empty dictionary, a data structure that we discuss in the next section.
...@@ -442,14 +442,14 @@ Here is a brief demonstration:: ...@@ -442,14 +442,14 @@ Here is a brief demonstration::
>>> a ^ b # letters in a or b but not both >>> a ^ b # letters in a or b but not both
{'r', 'd', 'b', 'm', 'z', 'l'} {'r', 'd', 'b', 'm', 'z', 'l'}
Like :ref:`for lists <tut-listcomps>`, there is a set comprehension syntax:: Similarly to :ref:`list comprehensions <tut-listcomps>`, set comprehensions
are also supported::
>>> a = {x for x in 'abracadabra' if x not in 'abc'} >>> a = {x for x in 'abracadabra' if x not in 'abc'}
>>> a >>> a
{'r', 'd'} {'r', 'd'}
.. _tut-dictionaries: .. _tut-dictionaries:
Dictionaries Dictionaries
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment