diff Doc/tutorial/datastructures.rst @ 63812:4bcd53617a65

Issue #4570: Clean-up tutorial example
author Raymond Hettinger <python@rcn.com>
date Sun, 08 Aug 2010 01:30:45 +0000
parents e1f4fc63d2b3
children 6c77757d0881
line wrap: on
line diff
--- a/Doc/tutorial/datastructures.rst	Sun Aug 08 01:13:42 2010 +0000
+++ b/Doc/tutorial/datastructures.rst	Sun Aug 08 01:30:45 2010 +0000
@@ -377,16 +377,12 @@
 
 Here is a brief demonstration::
 
-   >>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
-   >>> fruit = set(basket)               # create a set without duplicates
-   >>> fruit
-   {'orange', 'pear', 'apple', 'banana'}
-   >>> fruit = {'orange', 'apple'}       # {} syntax is equivalent to [] for lists
-   >>> fruit
-   {'orange', 'apple'}
-   >>> 'orange' in fruit                 # fast membership testing
+   >>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}
+   >>> print(basket)                      # show that duplicates have been removed
+   {'orange', 'bananna', 'pear', 'apple'}
+   >>> 'orange' in basket                 # fast membership testing
    True
-   >>> 'crabgrass' in fruit
+   >>> 'crabgrass' in basket
    False
 
    >>> # Demonstrate set operations on unique letters from two words