Commit 2409ed01 authored by Johannes Gijsbers's avatar Johannes Gijsbers

Patch #1025795: clarify language in Data Structures chapter of tutorial:

- Dictionary keys are in arbitrary order, but not random (which implies, well,
  intentional randomness).
- Move a footnote closer to what it's talking about so that it doesn't look
  like we're saying that "0 == 0.0" can't be relied on.
- Minor language tweaks in the vicinity.

Thanks Dima Dorfman!
parent 1c278865
...@@ -2122,7 +2122,7 @@ associated with that key is forgotten. It is an error to extract a ...@@ -2122,7 +2122,7 @@ associated with that key is forgotten. It is an error to extract a
value using a non-existent key. value using a non-existent key.
The \method{keys()} method of a dictionary object returns a list of all The \method{keys()} method of a dictionary object returns a list of all
the keys used in the dictionary, in random order (if you want it the keys used in the dictionary, in arbitrary order (if you want it
sorted, just apply the \method{sort()} method to the list of keys). To sorted, just apply the \method{sort()} method to the list of keys). To
check whether a single key is in the dictionary, use the check whether a single key is in the dictionary, use the
\method{has_key()} method of the dictionary. \method{has_key()} method of the dictionary.
...@@ -2231,8 +2231,8 @@ pear ...@@ -2231,8 +2231,8 @@ pear
\section{More on Conditions \label{conditions}} \section{More on Conditions \label{conditions}}
The conditions used in \code{while} and \code{if} statements above can The conditions used in \code{while} and \code{if} statements can
contain other operators besides comparisons. contain any operators, not just comparisons.
The comparison operators \code{in} and \code{not in} check whether a value The comparison operators \code{in} and \code{not in} check whether a value
occurs (does not occur) in a sequence. The operators \code{is} and occurs (does not occur) in a sequence. The operators \code{is} and
...@@ -2247,11 +2247,11 @@ whether \code{a} is less than \code{b} and moreover \code{b} equals ...@@ -2247,11 +2247,11 @@ whether \code{a} is less than \code{b} and moreover \code{b} equals
Comparisons may be combined by the Boolean operators \code{and} and Comparisons may be combined by the Boolean operators \code{and} and
\code{or}, and the outcome of a comparison (or of any other Boolean \code{or}, and the outcome of a comparison (or of any other Boolean
expression) may be negated with \code{not}. These all have lower expression) may be negated with \code{not}. These have lower
priorities than comparison operators again; between them, \code{not} has priorities than comparison operators; between them, \code{not} has
the highest priority, and \code{or} the lowest, so that the highest priority and \code{or} the lowest, so that
\code{A and not B or C} is equivalent to \code{(A and (not B)) or C}. Of \code{A and not B or C} is equivalent to \code{(A and (not B)) or C}.
course, parentheses can be used to express the desired composition. As always, parentheses can be used to express the desired composition.
The Boolean operators \code{and} and \code{or} are so-called The Boolean operators \code{and} and \code{or} are so-called
\emph{short-circuit} operators: their arguments are evaluated from \emph{short-circuit} operators: their arguments are evaluated from
...@@ -2307,12 +2307,12 @@ same types: ...@@ -2307,12 +2307,12 @@ same types:
Note that comparing objects of different types is legal. The outcome Note that comparing objects of different types is legal. The outcome
is deterministic but arbitrary: the types are ordered by their name. is deterministic but arbitrary: the types are ordered by their name.
Thus, a list is always smaller than a string, a string is always Thus, a list is always smaller than a string, a string is always
smaller than a tuple, etc. Mixed numeric types are compared according smaller than a tuple, etc. \footnote{
to their numeric value, so 0 equals 0.0, etc.\footnote{
The rules for comparing objects of different types should The rules for comparing objects of different types should
not be relied upon; they may change in a future version of not be relied upon; they may change in a future version of
the language. the language.
} } Mixed numeric types are compared according to their numeric value, so
0 equals 0.0, etc.
\chapter{Modules \label{modules}} \chapter{Modules \label{modules}}
......
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