

Return the number of occurrences of b in a. Operations which work with sequences (some of them with mappings too) include: operator. Return the bitwise exclusive or of a and b. The mathematical and bitwise operations are the most numerous: operator.

This isĮquivalent to using the bool constructor. Return True if obj is true, and False otherwise. The result is affected by the _bool_() and _not_() method for object instances only the interpreter core defines Truth tests, identity tests, and boolean operations: operator. The logical operations are also generally applicable to all objects, and support SeeĬomparisons for more information about rich comparisons. Or may not be interpretable as a Boolean value. Note that these functions can return any value, which may Specifically, lt(a, b) isĮquivalent to a b and ge(a, b) is equivalent to a >= b. Perform “rich comparisons” between a and b.

The rich comparison operators they support: operator. The object comparison functions are useful for all objects, and are named after Operations, mathematical operations and sequence operations. The functions fall into categories that perform object comparisons, logical Without the double underscores are preferred for clarity. Many of these have a variant with the double underscores kept. Special methods, without the double underscores. For example, operator.add(x, y) isĮquivalent to the expression x+y. The operator module exports a set of efficient functions corresponding to Operator - Standard operators as functions ¶
