[New-bugs-announce] [issue30312] Small correction in set code sample

Oskar Weser report at bugs.python.org
Tue May 9 04:47:27 EDT 2017


New submission from Oskar Weser:

There is a code example about the set type found under:
https://docs.python.org/3/tutorial/datastructures.html

It reads as:
```
>>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}
>>> print(basket)                      # show that duplicates have been removed
{'orange', 'banana', 'pear', 'apple'}
>>> 'orange' in basket                 # fast membership testing
True
>>> 'crabgrass' in basket
False

>>> # Demonstrate set operations on unique letters from two words
...
>>> a = set('abracadabra')
>>> b = set('alacazam')
>>> a                                  # unique letters in a
{'a', 'r', 'b', 'c', 'd'}
>>> a - b                              # letters in a but not in b
{'r', 'd', 'b'}
>>> a | b                              # letters in either a or b
```

I read "either a or b" as "a .EXOR. b". Shouldn't it be:
```
>>> a | b                              # letters in a or b
```
I don't speak English as a native language, so perhaps I am wrong.

----------
assignee: docs at python
components: Documentation
messages: 293291
nosy: docs at python, mcocdawc
priority: normal
severity: normal
status: open
title: Small correction in set code sample
versions: Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30312>
_______________________________________


More information about the New-bugs-announce mailing list