operator
Starlark module for working with operators interface.
This module exports a set of functions corresponding to the intrinsic operators of Python. For example, operator.add(x, y) is equivalent to the expression x+y. The function names are those used for special methods; variants without leading and trailing ' ' are also provided for convenience. This is a pure Python implementation of the module.
Similar to operator in Python.
operator.abs(a)
Same as abs(a).
operator.add(lhs, rhs)
A closure implementing a binary operation in Python.
operator.and(lhs, rhs)
A closure implementing a binary operation in Python.
operator.concat(a, b)
Same as a + b, for a and b sequences.
operator.contains(a, b)
Same as b in a (note reversed operands).
operator.countOf(a, b)
Return the number of times b occurs in a.
operator.delitem(a, b)
Same as del a[b].
operator.eq(lhs, rhs)
Implement the rich comparison a {operator} b.
operator.floordiv(lhs, rhs)
A closure implementing a binary operation in Python.
operator.ge(lhs, rhs)
Implement the rich comparison a {operator} b.
operator.getitem(a, b)
Same as a[b].
operator.gt(lhs, rhs)
Implement the rich comparison a {operator} b.
operator.iadd(a, b)
Same as a += b.
operator.iand(a, b)
Same as a &= b.
operator.iconcat(a, b)
Same as a += b, for a and b sequences.
operator.ifloordiv(a, b)
Same as a //= b.
operator.ilshift(a, b)
Same as a <<= b.
operator.imatmul(a, b)
Same as a @= b.
operator.imod(a, b)
Same as a %= b.
operator.imul(a, b)
Same as a *= b.
operator.index(a)
Same as a.index().
operator.indexOf(a, b)
Return the first index of b in a.
operator.inv(object_)
A closure implementing a unary arithmetic operation.
operator.invert(object_)
A closure implementing a unary arithmetic operation.
operator.ior(a, b)
Same as a |= b.
operator.ipow(a, b)
Same as a **= b.
operator.irshift(a, b)
Same as a >>= b.
operator.is_(a, b)
Same as a is b.
operator.is_not(a, b)
Same as a is not b.
operator.isub(a, b)
Same as a -= b.
operator.itruediv(a, b)
Same as a /= b.
operator.ixor(a, b)
Same as a ^= b.
operator.le(lhs, rhs)
Implement the rich comparison a {operator} b.
operator.length_hint(obj, default=0)
As defined in PEP 424. Return an estimate of the number of items in obj. This is useful for presizing containers when building from an iterable. If the object supports len(), the result will be exact. Otherwise, it may over- or under-estimate by an arbitrary amount. The result will be an integer >= 0.
operator.lshift(lhs, rhs)
A closure implementing a binary operation in Python.
operator.lt(lhs, rhs)
Implement the rich comparison a {operator} b.
operator.matmul(lhs, rhs)
A closure implementing a binary operation in Python.
operator.mod(lhs, rhs)
A closure implementing a binary operation in Python.
operator.mul(lhs, rhs)
A closure implementing a binary operation in Python.
operator.ne(lhs, rhs)
Implement the rich comparison a {operator} b.
operator.neg(object_)
A closure implementing a unary arithmetic operation.
operator.not_(a)
Same as not a.
operator.or_(lhs, rhs)
A closure implementing a binary operation in Python.
operator.pos(object_)
A closure implementing a unary arithmetic operation.
operator.pow(lhs, rhs)
A closure implementing a binary operation in Python.
operator.rshift(lhs, rhs)
A closure implementing a binary operation in Python.
operator.setitem(a, b, c)
Same as a[b] = c.
operator.sub(lhs, rhs)
A closure implementing a binary operation in Python.
operator.truediv(lhs, rhs)
A closure implementing a binary operation in Python.
operator.truth(a)
Return True if a is true, False otherwise.
operator.xor(lhs, rhs)
A closure implementing a binary operation in Python.
Last updated