Expand a bit on dict views.
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
index 7b718e8..58dd614 100644
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -154,6 +154,8 @@
['Michael', 'Terry', 'Graham']
+.. _tut-listcomps:
+
List Comprehensions
-------------------
@@ -401,7 +403,7 @@
>>> a ^ b # letters in a or b but not both
{'r', 'd', 'b', 'm', 'z', 'l'}
-Like for lists, there is a set comprehension syntax::
+Like :ref:`for lists <tut-listcomps>`, there is a set comprehension syntax::
>>> a = {x for x in 'abracadabra' if x not in 'abc'}
>>> a
@@ -438,9 +440,9 @@
using a non-existent key.
Performing ``list(d.keys())`` on a dictionary returns a list of all the keys
-used in the dictionary, in arbitrary order (if you want it sorted, just apply
-the :meth:`sorted` function instead). To check whether a single key is
-in the dictionary, use the :keyword:`in` keyword.
+used in the dictionary, in arbitrary order (if you want it sorted, just use
+``sorted(d.keys())`` instead). [1]_ To check whether a single key is in the
+dictionary, use the :keyword:`in` keyword.
Here is a small example using a dictionary::
@@ -463,9 +465,8 @@
>>> 'jack' not in tel
False
-The :func:`dict` constructor builds dictionaries directly from lists of
-key-value pairs stored as tuples. When the pairs form a pattern, list
-comprehensions can compactly specify the key-value list. ::
+The :func:`dict` constructor builds dictionaries directly from sequences of
+key-value pairs stored as tuples. ::
>>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)])
{'sape': 4139, 'jack': 4098, 'guido': 4127}
@@ -483,7 +484,6 @@
{'sape': 4139, 'jack': 4098, 'guido': 4127}
-.. XXX Find out the right way to do these DUBOIS
.. _tut-loopidioms:
Looping Techniques
@@ -604,9 +604,9 @@
the same type, the lexicographical comparison is carried out recursively. If
all items of two sequences compare equal, the sequences are considered equal.
If one sequence is an initial sub-sequence of the other, the shorter sequence is
-the smaller (lesser) one. Lexicographical ordering for strings uses the ASCII
-ordering for individual characters. Some examples of comparisons between
-sequences of the same type::
+the smaller (lesser) one. Lexicographical ordering for strings uses the Unicode
+codepoint number to order individual characters. Some examples of comparisons
+between sequences of the same type::
(1, 2, 3) < (1, 2, 4)
[1, 2, 3] < [1, 2, 4]
@@ -621,3 +621,10 @@
mixed numeric types are compared according to their numeric value, so 0 equals
0.0, etc. Otherwise, rather than providing an arbitrary ordering, the
interpreter will raise a :exc:`TypeError` exception.
+
+
+.. rubric:: Footnotes
+
+.. [1] Calling ``d.keys()`` will return a :dfn:`dictionary view` object. It
+ supports operations like membership test and iteration, but its contents
+ are not independent of the original dictionary -- it is only a *view*.