Copyright (C) 2000-2012 |
GNU Info (python2.1-lib.info)Mapping Operators to FunctionsMapping Operators to Functions ------------------------------ This table shows how abstract operations correspond to operator symbols in the Python syntax and the functions in the `operator' module. Operation Syntax Function ------ ----- ----- Addition `A + B' `add(A, B)' Concatenation `SEQ1 + SEQ2' `concat(SEQ1, SEQ2)' Containment Test `O in SEQ' `contains(SEQ, O)' Division `A / B' `div(A, B)' Bitwise And `A & B' `and_(A, B)' Bitwise Exclusive Or `A ^ B' `xor(A, B)' Bitwise Inversion `~{} A' `invert(A)' Bitwise Or `A | B' `or_(A, B)' Indexed Assignment `O[K] = V' `setitem(O, K, V)' Indexed Deletion `del O[K]' `delitem(O, K)' Indexing `O[K]' `getitem(O, K)' Left Shift `A <`<' B' `lshift(A, B)' Modulo `A % B' `mod(A, B)' Multiplication `A * B' `mul(A, B)' Negation (Arithmetic) `- A' `neg(A)' Negation (Logical) `not A' `not_(A)' Right Shift `A >`>' B' `rshift(A, B)' Sequence Repitition `SEQ * I' `repeat(SEQ, I)' Slice Assignment `SEQ[I:J]' = VALUES `setslice(SEQ, I, J, VALUES)' Slice Deletion `del SEQ[I:J]' `delslice(SEQ, I, J)' Slicing `SEQ[I:J]' `getslice(SEQ, I, J)' String Formatting `S % O' `mod(S, O)' Subtraction `A - B' `sub(A, B)' Truth Test `O' `truth(O)' automatically generated by info2www version 1.2.2.9 |