summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-07-22 19:33:53 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-07-22 19:33:53 (GMT)
commitcab5b94592eeace0988d00bba62dc1257405302d (patch)
treef95957f62e43fd1df84274aa64619cc6e157a3df
parent7bd33c5e22c67e06042fb7ab1186f7587d78153d (diff)
downloadcpython-cab5b94592eeace0988d00bba62dc1257405302d.zip
cpython-cab5b94592eeace0988d00bba62dc1257405302d.tar.gz
cpython-cab5b94592eeace0988d00bba62dc1257405302d.tar.bz2
SF bug #995983 and #995987: Documentation nits.
-rw-r--r--Doc/lib/libstdtypes.tex12
1 files changed, 7 insertions, 5 deletions
diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex
index 66e5702..7d69b64 100644
--- a/Doc/lib/libstdtypes.tex
+++ b/Doc/lib/libstdtypes.tex
@@ -1185,6 +1185,10 @@ subset of the second set (is a subset, but is not equal).
A set is greater than another set if and only if the first set is a proper
superset of the second set (is a superset, but is not equal).
+Instanceas of \class{set} are compared to instances of \class{frozenset} based
+on their members. For example, \samp{set('abc') == frozenset('abc')} returns
+\code{True}.
+
The subset and equality comparisons do not generalize to a complete
ordering function. For example, any two disjoint sets are not equal and
are not subsets of each other, so \emph{all} of the following return
@@ -1195,11 +1199,9 @@ Accordingly, sets do not implement the \method{__cmp__} method.
Since sets only define partial ordering (subset relationships), the output
of the \method{list.sort()} method is undefined for lists of sets.
-For convenience in implementing sets of sets, the \method{__contains__()},
-\method{remove()}, and \method{discard()} methods automatically match
-instances of the \class{set} class their \class{frozenset} counterparts
-inside a set. For example, \code{set('abc') in set([frozenset('abc')])}
-returns \code{True}.
+Binary operations that mix \class{set} instances with \class{frozenset}
+return the type of the first operand. For example:
+\samp{frozenset('ab') | set('bc')} returns an instance of \class{frozenset}.
The following table lists operations available for \class{set}
that do not apply to immutable instances of \class{frozenset}: