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