annotate Doc/lib/liboperator.tex @ 17322:bd110eadc19a legacy-trunk

One-liner critical fix from Jim Fulton: Eric's string-method crusade got the order backwards in a line (for .find()).
author Tim Peters <tim.peters@gmail.com>
date Thu, 05 Apr 2001 22:26:23 +0000
parents e0765c5512d7
children 40a17d9500a8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8918
acfffe14628e New section header style.
Fred Drake <fdrake@acm.org>
parents: 8716
diff changeset
1 \section{\module{operator} ---
acfffe14628e New section header style.
Fred Drake <fdrake@acm.org>
parents: 8716
diff changeset
2 Standard operators as functions.}
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8418
diff changeset
3 \declaremodule{builtin}{operator}
8918
acfffe14628e New section header style.
Fred Drake <fdrake@acm.org>
parents: 8716
diff changeset
4 \sectionauthor{Skip Montanaro}{skip@automatrix.com}
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8418
diff changeset
5
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8418
diff changeset
6 \modulesynopsis{All Python's standard operators as built-in functions.}
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8418
diff changeset
7
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
8
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
9 The \module{operator} module exports a set of functions implemented in C
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 corresponding to the intrinsic operators of Python. For example,
6955
38493b9376ea Remove unneeded "{}" that confused makeinfo.
Fred Drake <fdrake@acm.org>
parents: 6876
diff changeset
11 \code{operator.add(x, y)} is equivalent to the expression \code{x+y}. The
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
12 function names are those used for special class methods; variants without
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
13 leading and trailing \samp{__} are also provided for convenience.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
14
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
15 The \module{operator} module defines the following functions:
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
16
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
17 \begin{funcdesc}{add}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
18 \funcline{__add__}{a, b}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
19 Return \var{a} \code{+} \var{b}, for \var{a} and \var{b} numbers.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
20 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
21
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
22 \begin{funcdesc}{sub}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
23 \funcline{__sub__}{a, b}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
24 Return \var{a} \code{-} \var{b}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
25 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
26
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
27 \begin{funcdesc}{mul}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
28 \funcline{__mul__}{a, b}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
29 Return \var{a} \code{*} \var{b}, for \var{a} and \var{b} numbers.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
30 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
31
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
32 \begin{funcdesc}{div}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
33 \funcline{__div__}{a, b}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
34 Return \var{a} \code{/} \var{b}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
35 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
36
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
37 \begin{funcdesc}{mod}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
38 \funcline{__mod__}{a, b}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
39 Return \var{a} \code{\%} \var{b}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
40 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
41
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
42 \begin{funcdesc}{neg}{o}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
43 \funcline{__neg__}{o}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
44 Return \var{o} negated.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
45 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
46
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
47 \begin{funcdesc}{pos}{o}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
48 \funcline{__pos__}{o}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
49 Return \var{o} positive.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
50 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
51
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
52 \begin{funcdesc}{abs}{o}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
53 \funcline{__abs__}{o}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
54 Return the absolute value of \var{o}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
55 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
56
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
57 \begin{funcdesc}{inv}{o}
15291
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
58 \funcline{invert}{o}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
59 \funcline{__inv__}{o}
14655
0228914e0c5f Added documentation for new functions.
Fred Drake <fdrake@acm.org>
parents: 10991
diff changeset
60 \funcline{__invert__}{o}
15578
e0765c5512d7 Grant Griffin <grant.griffin@honeywell.com>:
Fred Drake <fdrake@acm.org>
parents: 15291
diff changeset
61 Return the bitwise inverse of the number \var{o}. The names
e0765c5512d7 Grant Griffin <grant.griffin@honeywell.com>:
Fred Drake <fdrake@acm.org>
parents: 15291
diff changeset
62 \function{invert()} and \function{__invert__()} were added in Python
e0765c5512d7 Grant Griffin <grant.griffin@honeywell.com>:
Fred Drake <fdrake@acm.org>
parents: 15291
diff changeset
63 2.0.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
64 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
65
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
66 \begin{funcdesc}{lshift}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
67 \funcline{__lshift__}{a, b}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
68 Return \var{a} shifted left by \var{b}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
69 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
70
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
71 \begin{funcdesc}{rshift}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
72 \funcline{__rshift__}{a, b}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
73 Return \var{a} shifted right by \var{b}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
74 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
75
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
76 \begin{funcdesc}{and_}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
77 \funcline{__and__}{a, b}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
78 Return the bitwise and of \var{a} and \var{b}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
79 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
80
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
81 \begin{funcdesc}{or_}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
82 \funcline{__or__}{a, b}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
83 Return the bitwise or of \var{a} and \var{b}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
84 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
85
8418
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
86 \begin{funcdesc}{xor}{a, b}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
87 \funcline{__xor__}{a, b}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
88 Return the bitwise exclusive or of \var{a} and \var{b}.
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
89 \end{funcdesc}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
90
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
91 \begin{funcdesc}{not_}{o}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
92 \funcline{__not__}{o}
10991
46a56177322e Added note to __not__() description that this operation is defined
Fred Drake <fdrake@acm.org>
parents: 8918
diff changeset
93 Return the outcome of \keyword{not} \var{o}. (Note that there is no
15061
103612516aa8 It turns out that Guido does not like or encourage the use of the term
Fred Drake <fdrake@acm.org>
parents: 14965
diff changeset
94 \method{__not__()} method for object instances; only the interpreter
103612516aa8 It turns out that Guido does not like or encourage the use of the term
Fred Drake <fdrake@acm.org>
parents: 14965
diff changeset
95 core defines this operation.)
8418
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
96 \end{funcdesc}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
97
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
98 \begin{funcdesc}{truth}{o}
8918
acfffe14628e New section header style.
Fred Drake <fdrake@acm.org>
parents: 8716
diff changeset
99 Return \code{1} if \var{o} is true, and 0 otherwise.
8418
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
100 \end{funcdesc}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
101
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
102 \begin{funcdesc}{concat}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
103 \funcline{__concat__}{a, b}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
104 Return \var{a} \code{+} \var{b} for \var{a} and \var{b} sequences.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
105 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
106
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
107 \begin{funcdesc}{repeat}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
108 \funcline{__repeat__}{a, b}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
109 Return \var{a} \code{*} \var{b} where \var{a} is a sequence and
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
110 \var{b} is an integer.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
111 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
112
8418
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
113 \begin{funcdesc}{contains}{a, b}
14655
0228914e0c5f Added documentation for new functions.
Fred Drake <fdrake@acm.org>
parents: 10991
diff changeset
114 \funcline{__contains__}{a, b}
8418
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
115 Return the outcome of the test \var{b} \code{in} \var{a}.
14655
0228914e0c5f Added documentation for new functions.
Fred Drake <fdrake@acm.org>
parents: 10991
diff changeset
116 Note the reversed operands. The name \function{__contains__()} was
0228914e0c5f Added documentation for new functions.
Fred Drake <fdrake@acm.org>
parents: 10991
diff changeset
117 added in Python 2.0.
0228914e0c5f Added documentation for new functions.
Fred Drake <fdrake@acm.org>
parents: 10991
diff changeset
118 \end{funcdesc}
0228914e0c5f Added documentation for new functions.
Fred Drake <fdrake@acm.org>
parents: 10991
diff changeset
119
0228914e0c5f Added documentation for new functions.
Fred Drake <fdrake@acm.org>
parents: 10991
diff changeset
120 \begin{funcdesc}{sequenceIncludes}{\unspecified}
0228914e0c5f Added documentation for new functions.
Fred Drake <fdrake@acm.org>
parents: 10991
diff changeset
121 \deprecated{2.0}{Use \function{contains()} instead.}
0228914e0c5f Added documentation for new functions.
Fred Drake <fdrake@acm.org>
parents: 10991
diff changeset
122 Alias for \function{contains()}.
8418
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
123 \end{funcdesc}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
124
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
125 \begin{funcdesc}{countOf}{a, b}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
126 Return the number of occurrences of \var{b} in \var{a}.
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
127 \end{funcdesc}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
128
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
129 \begin{funcdesc}{indexOf}{a, b}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
130 Return the index of the first of occurrence of \var{b} in \var{a}.
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
131 \end{funcdesc}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
132
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
133 \begin{funcdesc}{getitem}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
134 \funcline{__getitem__}{a, b}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
135 Return the value of \var{a} at index \var{b}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
136 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
137
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
138 \begin{funcdesc}{setitem}{a, b, c}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
139 \funcline{__setitem__}{a, b, c}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
140 Set the value of \var{a} at index \var{b} to \var{c}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
141 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
142
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
143 \begin{funcdesc}{delitem}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
144 \funcline{__delitem__}{a, b}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
145 Remove the value of \var{a} at index \var{b}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
146 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
147
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
148 \begin{funcdesc}{getslice}{a, b, c}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
149 \funcline{__getslice__}{a, b, c}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
150 Return the slice of \var{a} from index \var{b} to index \var{c}\code{-1}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
151 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
152
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
153 \begin{funcdesc}{setslice}{a, b, c, v}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
154 \funcline{__setslice__}{a, b, c, v}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
155 Set the slice of \var{a} from index \var{b} to index \var{c}\code{-1} to the
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
156 sequence \var{v}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
157 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
158
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
159 \begin{funcdesc}{delslice}{a, b, c}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
160 \funcline{__delslice__}{a, b, c}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
161 Delete the slice of \var{a} from index \var{b} to index \var{c}\code{-1}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
162 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
163
14965
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
164 The \module{operator} also defines a few predicates to test the type
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
165 of objects. \strong{Note:} Be careful not to misinterpret the
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
166 results of these functions; only \function{isCallable()} has any
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
167 measure of reliability with instance objects. For example:
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
168
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
169 \begin{verbatim}
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
170 >>> class C:
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
171 ... pass
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
172 ...
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
173 >>> import operator
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
174 >>> o = C()
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
175 >>> operator.isMappingType(o)
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
176 1
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
177 \end{verbatim}
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
178
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
179 \begin{funcdesc}{isCallable}{o}
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
180 \deprecated{2.0}{Use the \function{callable()} built-in function instead.}
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
181 Returns true if the object \var{o} can be called like a function,
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
182 otherwise it returns false. True is returned for functions, bound and
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
183 unbound methods, class objects, and instance objects which support the
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
184 \method{__call__()} method.
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
185 \end{funcdesc}
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
186
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
187 \begin{funcdesc}{isMappingType}{o}
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
188 Returns true if the object \var{o} supports the mapping interface.
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
189 This is true for dictionaries and all instance objects.
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
190 \strong{Warning:} There is no reliable way to test if an instance
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
191 supports the complete mapping protocol since the interface itself is
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
192 ill-defined. This makes this test less useful than it otherwise might
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
193 be.
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
194 \end{funcdesc}
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
195
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
196 \begin{funcdesc}{isNumberType}{o}
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
197 Returns true if the object \var{o} represents a number. This is true
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
198 for all numeric types implemented in C, and for all instance objects.
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
199 \strong{Warning:} There is no reliable way to test if an instance
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
200 supports the complete numeric interface since the interface itself is
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
201 ill-defined. This makes this test less useful than it otherwise might
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
202 be.
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
203 \end{funcdesc}
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
204
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
205 \begin{funcdesc}{isSequenceType}{o}
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
206 Returns true if the object \var{o} supports the sequence protocol.
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
207 This returns true for all objects which define sequence methods in C,
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
208 and for all instance objects. \strong{Warning:} There is no reliable
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
209 way to test if an instance supports the complete sequence interface
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
210 since the interface itself is ill-defined. This makes this test less
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
211 useful than it otherwise might be.
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
212 \end{funcdesc}
1aa37008fd2c Add documentation and warnings for the isCallable(), isMappingType(),
Fred Drake <fdrake@acm.org>
parents: 14655
diff changeset
213
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
214
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
215 Example: Build a dictionary that maps the ordinals from \code{0} to
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
216 \code{256} to their character equivalents.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
217
7277
bf4e790bd61a Remove all \bcode / \ecode cruft; this is no longer needed. See previous
Fred Drake <fdrake@acm.org>
parents: 6955
diff changeset
218 \begin{verbatim}
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
219 >>> import operator
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
220 >>> d = {}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
221 >>> keys = range(256)
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
222 >>> vals = map(chr, keys)
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
223 >>> map(operator.setitem, [d]*len(keys), keys, vals)
7277
bf4e790bd61a Remove all \bcode / \ecode cruft; this is no longer needed. See previous
Fred Drake <fdrake@acm.org>
parents: 6955
diff changeset
224 \end{verbatim}
15291
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
225
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
226
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
227 \subsection{Mapping Operators to Functions \label{operator-map}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
228
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
229 This table shows how abstract operations correspond to operator
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
230 symbols in the Python syntax and the functions in the
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
231 \refmodule{operator} module.
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
232
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
233
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
234 \begin{tableiii}{l|c|l}{textrm}{Operation}{Syntax}{Function}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
235 \lineiii{Addition}{\code{\var{a} + \var{b}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
236 {\code{add(\var{a}, \var{b})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
237 \lineiii{Concatenation}{\code{\var{seq1} + \var{seq2}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
238 {\code{concat(\var{seq1}, \var{seq2})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
239 \lineiii{Containment Test}{\code{\var{o} in \var{seq}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
240 {\code{contains(\var{seq}, \var{o})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
241 \lineiii{Division}{\code{\var{a} / \var{b}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
242 {\code{div(\var{a}, \var{b})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
243 \lineiii{Bitwise And}{\code{\var{a} \&\ \var{b}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
244 {\code{and_(\var{a}, \var{b})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
245 \lineiii{Bitwise Exclusive Or}{\code{\var{a} \^\ \var{b}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
246 {\code{xor(\var{a}, \var{b})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
247 \lineiii{Bitwise Inversion}{\code{\~{} \var{a}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
248 {\code{invert(\var{a})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
249 \lineiii{Bitwise Or}{\code{\var{a} | \var{b}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
250 {\code{or_(\var{a}, \var{b})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
251 \lineiii{Indexed Assignment}{\code{\var{o}[\var{k}] = \var{v}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
252 {\code{setitem(\var{o}, \var{k}, \var{v})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
253 \lineiii{Indexed Deletion}{\code{del \var{o}[\var{k}]}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
254 {\code{delitem(\var{o}, \var{k})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
255 \lineiii{Indexing}{\code{\var{o}[\var{k}]}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
256 {\code{getitem(\var{o}, \var{k})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
257 \lineiii{Left Shift}{\code{\var{a} <\code{<} \var{b}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
258 {\code{lshift(\var{a}, \var{b})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
259 \lineiii{Modulo}{\code{\var{a} \%\ \var{b}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
260 {\code{mod(\var{a}, \var{b})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
261 \lineiii{Multiplication}{\code{\var{a} * \var{b}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
262 {\code{mul(\var{a}, \var{b})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
263 \lineiii{Negation (Arithmetic)}{\code{- \var{a}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
264 {\code{neg(\var{a})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
265 \lineiii{Negation (Logical)}{\code{not \var{a}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
266 {\code{not_(\var{a})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
267 \lineiii{Right Shift}{\code{\var{a} >\code{>} \var{b}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
268 {\code{rshift(\var{a}, \var{b})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
269 \lineiii{Sequence Repitition}{\code{\var{seq} * \var{i}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
270 {\code{repeat(\var{seq}, \var{i})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
271 \lineiii{Slice Assignment}{\code{\var{seq}[\var{i}:\var{j}]} = \var{values}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
272 {\code{setslice(\var{seq}, \var{i}, \var{j}, \var{values})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
273 \lineiii{Slice Deletion}{\code{del \var{seq}[\var{i}:\var{j}]}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
274 {\code{delslice(\var{seq}, \var{i}, \var{j})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
275 \lineiii{Slicing}{\code{\var{seq}[\var{i}:\var{j}]}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
276 {\code{getslice(\var{seq}, \var{i}, \var{j})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
277 \lineiii{String Formatting}{\code{\var{s} \%\ \var{o}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
278 {\code{mod(\var{s}, \var{o})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
279 \lineiii{Subtraction}{\code{\var{a} - \var{b}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
280 {\code{sub(\var{a}, \var{b})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
281 \lineiii{Truth Test}{\code{\var{o}}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
282 {\code{truth(\var{o})}}
1f9d5eb84b0b Added missing entry for invert() function.
Fred Drake <fdrake@acm.org>
parents: 15061
diff changeset
283 \end{tableiii}