annotate Doc/lib/liboperator.tex @ 8831:00a6bb65ff29 legacy-trunk

Getting rid of this ancient stuff.
author Guido van Rossum <guido@python.org>
date Wed, 05 Aug 1998 21:10:09 +0000
parents 760dcf197048
children acfffe14628e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 % Contributed by Skip Montanaro, from the module's doc strings.
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
7877
8e5223680a9d Remove all uses of \sectcode; we can now use logical markup everywhere.
Fred Drake <fdrake@acm.org>
parents: 7603
diff changeset
3 \section{Built-in Module \module{operator}}
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8418
diff changeset
4 \declaremodule{builtin}{operator}
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}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
58 \funcline{__inv__}{o}
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
59 Return the inverse of \var{o}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
60 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
61
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
62 \begin{funcdesc}{lshift}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
63 \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
64 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
65 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
66
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
67 \begin{funcdesc}{rshift}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
68 \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
69 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
70 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
71
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
72 \begin{funcdesc}{and_}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
73 \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
74 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
75 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
76
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
77 \begin{funcdesc}{or_}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
78 \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
79 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
80 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
81
8418
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
82 \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
83 \funcline{__xor__}{a, b}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
84 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
85 \end{funcdesc}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
86
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
87 \begin{funcdesc}{not_}{o}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
88 \funcline{__not__}{o}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
89 Return the outcome of \keyword{not} \var{o}.
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
90 \end{funcdesc}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
91
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
92 \begin{funcdesc}{truth}{o}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
93 Return 1 if \var{o} is true, and 0 otherwise.
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
94 \end{funcdesc}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
95
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
96 \begin{funcdesc}{concat}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
97 \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
98 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
99 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
100
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
101 \begin{funcdesc}{repeat}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
102 \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
103 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
104 \var{b} is an integer.
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
8418
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
107 \begin{funcdesc}{contains}{a, b}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
108 \funcline{sequenceIncludes}{a, b}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
109 Return the outcome of the test \var{b} \code{in} \var{a}.
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
110 Note the reversed operands.
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
111 \end{funcdesc}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
112
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
113 \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
114 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
115 \end{funcdesc}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
116
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
117 \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
118 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
119 \end{funcdesc}
b5ff663ee76d Document missing functions: xor, not, truth, countOf, indexOf, and
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
120
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
121 \begin{funcdesc}{getitem}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
122 \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
123 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
124 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
125
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
126 \begin{funcdesc}{setitem}{a, b, c}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
127 \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
128 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
129 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
130
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
131 \begin{funcdesc}{delitem}{a, b}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
132 \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
133 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
134 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
135
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
136 \begin{funcdesc}{getslice}{a, b, c}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
137 \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
138 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
139 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
140
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
141 \begin{funcdesc}{setslice}{a, b, c, v}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
142 \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
143 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
144 sequence \var{v}.
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
145 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
146
6745
1db41ca45c7f Removed unnecessary escaping.
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
147 \begin{funcdesc}{delslice}{a, b, c}
7603
c0bf9b60c298 Some logical markup.
Fred Drake <fdrake@acm.org>
parents: 7343
diff changeset
148 \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
149 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
150 \end{funcdesc}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
151
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
152
6876
4e2cc5044fa5 Descriptions for delitem(), __delitem__(): These delete a value, not set it.
Fred Drake <fdrake@acm.org>
parents: 6871
diff changeset
153 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
154 \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
155
7277
bf4e790bd61a Remove all \bcode / \ecode cruft; this is no longer needed. See previous
Fred Drake <fdrake@acm.org>
parents: 6955
diff changeset
156 \begin{verbatim}
4610
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
157 >>> import operator
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
158 >>> d = {}
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
159 >>> keys = range(256)
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
160 >>> vals = map(chr, keys)
bb4094ff7bdf Added section for operator module (compiled Skip Montanaro).
Guido van Rossum <guido@python.org>
parents:
diff changeset
161 >>> 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
162 \end{verbatim}