[New-bugs-announce] [issue4570] Bad example in set tutorial

John Marter report at bugs.python.org
Sun Dec 7 02:10:12 CET 2008


New submission from John Marter <jmarter at gmail.com>:

On http://docs.python.org/3.0/tutorial/datastructures.html#sets there is
the following section in the section on sets

>>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}
>>> print(basket)
{'orange', 'bananna', 'pear', 'apple'}
>>> fruit = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
>>> fruit = set(basket)               # create a set without duplicates
>>> fruit
{'orange', 'pear', 'apple', 'banana'}


The third command should be an assignment to basket rather than fruit.

----------
assignee: georg.brandl
components: Documentation
messages: 77201
nosy: georg.brandl, jmarter
severity: normal
status: open
title: Bad example in set tutorial

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


More information about the New-bugs-announce mailing list