summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-01-27 19:09:43 (GMT)
committerGuido van Rossum <guido@python.org>1998-01-27 19:09:43 (GMT)
commit7570669a0838e5b1ae868774f35105107fa1992b (patch)
treea0be429c3a24df98777ba242e41e5992c46f21ef
parent516f18993f97c58f2bb41543bc878b3d7a1338fe (diff)
downloadcpython-7570669a0838e5b1ae868774f35105107fa1992b.zip
cpython-7570669a0838e5b1ae868774f35105107fa1992b.tar.gz
cpython-7570669a0838e5b1ae868774f35105107fa1992b.tar.bz2
Add a note explaining that multiplying a sequence with a negative
number is the same as multiplying it with zero, and yields an empty sequence.
-rw-r--r--Doc/lib/libtypes.tex6
-rw-r--r--Doc/libtypes.tex6
2 files changed, 10 insertions, 2 deletions
diff --git a/Doc/lib/libtypes.tex b/Doc/lib/libtypes.tex
index ed0ed9b..6cb66f9 100644
--- a/Doc/lib/libtypes.tex
+++ b/Doc/lib/libtypes.tex
@@ -330,7 +330,7 @@ equal to \var{x}, else \code{1}}{}
\hline
\lineiii{\var{s} + \var{t}}{the concatenation of \var{s} and \var{t}}{}
\hline
- \lineiii{\var{s} * \var{n}{\rm ,} \var{n} * \var{s}}{\var{n} copies of \var{s} concatenated}{}
+ \lineiii{\var{s} * \var{n}{\rm ,} \var{n} * \var{s}}{\var{n} copies of \var{s} concatenated}{(3)}
\hline
\lineiii{\var{s}[\var{i}]}{\var{i}'th item of \var{s}, origin 0}{(1)}
\lineiii{\var{s}[\var{i}:\var{j}]}{slice of \var{s} from \var{i} to \var{j}}{(1), (2)}
@@ -367,6 +367,10 @@ Notes:
use \code{0}. If \var{j} is omitted, use \code{len(\var{s})}. If
\var{i} is greater than or equal to \var{j}, the slice is empty.
+\item[(3)] Values of \var{n} less than \code{0} are treated as
+ \code{0} (which yields an empty sequence of the same type as
+ \var{s}).
+
\end{description}
\subsubsection{More String Operations}
diff --git a/Doc/libtypes.tex b/Doc/libtypes.tex
index ed0ed9b..6cb66f9 100644
--- a/Doc/libtypes.tex
+++ b/Doc/libtypes.tex
@@ -330,7 +330,7 @@ equal to \var{x}, else \code{1}}{}
\hline
\lineiii{\var{s} + \var{t}}{the concatenation of \var{s} and \var{t}}{}
\hline
- \lineiii{\var{s} * \var{n}{\rm ,} \var{n} * \var{s}}{\var{n} copies of \var{s} concatenated}{}
+ \lineiii{\var{s} * \var{n}{\rm ,} \var{n} * \var{s}}{\var{n} copies of \var{s} concatenated}{(3)}
\hline
\lineiii{\var{s}[\var{i}]}{\var{i}'th item of \var{s}, origin 0}{(1)}
\lineiii{\var{s}[\var{i}:\var{j}]}{slice of \var{s} from \var{i} to \var{j}}{(1), (2)}
@@ -367,6 +367,10 @@ Notes:
use \code{0}. If \var{j} is omitted, use \code{len(\var{s})}. If
\var{i} is greater than or equal to \var{j}, the slice is empty.
+\item[(3)] Values of \var{n} less than \code{0} are treated as
+ \code{0} (which yields an empty sequence of the same type as
+ \var{s}).
+
\end{description}
\subsubsection{More String Operations}