operator
index
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/operator.so
Module Docs

Operator interface.
 
This module exports a set of functions implemented in C 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.

 
Classes
       
__builtin__.object
attrgetter
itemgetter
methodcaller

 
class attrgetter(__builtin__.object)
    attrgetter(attr, ...) --> attrgetter object
 
Return a callable object that fetches the given attribute(s) from its operand.
After f = attrgetter('name'), the call f(r) returns r.name.
After g = attrgetter('name', 'date'), the call g(r) returns (r.name, r.date).
After h = attrgetter('name.first', 'name.last'), the call h(r) returns
(r.name.first, r.name.last).
 
  Methods defined here:
__call__(...)
x.__call__(...) <==> x(...)
__getattribute__(...)
x.__getattribute__('name') <==> x.name

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class itemgetter(__builtin__.object)
    itemgetter(item, ...) --> itemgetter object
 
Return a callable object that fetches the given item(s) from its operand.
After f = itemgetter(2), the call f(r) returns r[2].
After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])
 
  Methods defined here:
__call__(...)
x.__call__(...) <==> x(...)
__getattribute__(...)
x.__getattribute__('name') <==> x.name

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class methodcaller(__builtin__.object)
    methodcaller(name, ...) --> methodcaller object
 
Return a callable object that calls the given method on its operand.
After f = methodcaller('name'), the call f(r) returns r.name().
After g = methodcaller('name', 'date', foo=1), the call g(r) returns
r.name('date', foo=1).
 
  Methods defined here:
__call__(...)
x.__call__(...) <==> x(...)
__getattribute__(...)
x.__getattribute__('name') <==> x.name

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
Functions
       
__abs__(...)
abs(a) -- Same as abs(a).
__add__(...)
add(a, b) -- Same as a + b.
__and__(...)
and_(a, b) -- Same as a & b.
__concat__(...)
concat(a, b) -- Same as a + b, for a and b sequences.
__contains__(...)
contains(a, b) -- Same as b in a (note reversed operands).
__delitem__(...)
delitem(a, b) -- Same as del a[b].
__delslice__(...)
delslice(a, b, c) -- Same as del a[b:c].
__div__(...)
div(a, b) -- Same as a / b when __future__.division is not in effect.
__eq__(...)
eq(a, b) -- Same as a==b.
__floordiv__(...)
floordiv(a, b) -- Same as a // b.
__ge__(...)
ge(a, b) -- Same as a>=b.
__getitem__(...)
getitem(a, b) -- Same as a[b].
__getslice__(...)
getslice(a, b, c) -- Same as a[b:c].
__gt__(...)
gt(a, b) -- Same as a>b.
__iadd__(...)
a = iadd(a, b) -- Same as a += b.
__iand__(...)
a = iand(a, b) -- Same as a &= b.
__iconcat__(...)
a = iconcat(a, b) -- Same as a += b, for a and b sequences.
__idiv__(...)
a = idiv(a, b) -- Same as a /= b when __future__.division is not in effect.
__ifloordiv__(...)
a = ifloordiv(a, b) -- Same as a //= b.
__ilshift__(...)
a = ilshift(a, b) -- Same as a <<= b.
__imod__(...)
a = imod(a, b) -- Same as a %= b.
__imul__(...)
a = imul(a, b) -- Same as a *= b.
__index__(...)
index(a) -- Same as a.__index__()
__inv__(...)
inv(a) -- Same as ~a.
__invert__(...)
invert(a) -- Same as ~a.
__ior__(...)
a = ior(a, b) -- Same as a |= b.
__ipow__(...)
a = ipow(a, b) -- Same as a **= b.
__irepeat__(...)
a = irepeat(a, b) -- Same as a *= b, where a is a sequence, and b is an integer.
__irshift__(...)
a = irshift(a, b) -- Same as a >>= b.
__isub__(...)
a = isub(a, b) -- Same as a -= b.
__itruediv__(...)
a = itruediv(a, b) -- Same as a /= b when __future__.division is in effect.
__ixor__(...)
a = ixor(a, b) -- Same as a ^= b.
__le__(...)
le(a, b) -- Same as a<=b.
__lshift__(...)
lshift(a, b) -- Same as a << b.
__lt__(...)
lt(a, b) -- Same as a<b.
__mod__(...)
mod(a, b) -- Same as a % b.
__mul__(...)
mul(a, b) -- Same as a * b.
__ne__(...)
ne(a, b) -- Same as a!=b.
__neg__(...)
neg(a) -- Same as -a.
__not__(...)
not_(a) -- Same as not a.
__or__(...)
or_(a, b) -- Same as a | b.
__pos__(...)
pos(a) -- Same as +a.
__pow__(...)
pow(a, b) -- Same as a ** b.
__repeat__(...)
repeat(a, b) -- Return a * b, where a is a sequence, and b is an integer.
__rshift__(...)
rshift(a, b) -- Same as a >> b.
__setitem__(...)
setitem(a, b, c) -- Same as a[b] = c.
__setslice__(...)
setslice(a, b, c, d) -- Same as a[b:c] = d.
__sub__(...)
sub(a, b) -- Same as a - b.
__truediv__(...)
truediv(a, b) -- Same as a / b when __future__.division is in effect.
__xor__(...)
xor(a, b) -- Same as a ^ b.
abs(...)
abs(a) -- Same as abs(a).
add(...)
add(a, b) -- Same as a + b.
and_(...)
and_(a, b) -- Same as a & b.
concat(...)
concat(a, b) -- Same as a + b, for a and b sequences.
contains(...)
contains(a, b) -- Same as b in a (note reversed operands).
countOf(...)
countOf(a, b) -- Return the number of times b occurs in a.
delitem(...)
delitem(a, b) -- Same as del a[b].
delslice(...)
delslice(a, b, c) -- Same as del a[b:c].
div(...)
div(a, b) -- Same as a / b when __future__.division is not in effect.
eq(...)
eq(a, b) -- Same as a==b.
floordiv(...)
floordiv(a, b) -- Same as a // b.
ge(...)
ge(a, b) -- Same as a>=b.
getitem(...)
getitem(a, b) -- Same as a[b].
getslice(...)
getslice(a, b, c) -- Same as a[b:c].
gt(...)
gt(a, b) -- Same as a>b.
iadd(...)
a = iadd(a, b) -- Same as a += b.
iand(...)
a = iand(a, b) -- Same as a &= b.
iconcat(...)
a = iconcat(a, b) -- Same as a += b, for a and b sequences.
idiv(...)
a = idiv(a, b) -- Same as a /= b when __future__.division is not in effect.
ifloordiv(...)
a = ifloordiv(a, b) -- Same as a //= b.
ilshift(...)
a = ilshift(a, b) -- Same as a <<= b.
imod(...)
a = imod(a, b) -- Same as a %= b.
imul(...)
a = imul(a, b) -- Same as a *= b.
index(...)
index(a) -- Same as a.__index__()
indexOf(...)
indexOf(a, b) -- Return the first index of b in a.
inv(...)
inv(a) -- Same as ~a.
invert(...)
invert(a) -- Same as ~a.
ior(...)
a = ior(a, b) -- Same as a |= b.
ipow(...)
a = ipow(a, b) -- Same as a **= b.
irepeat(...)
a = irepeat(a, b) -- Same as a *= b, where a is a sequence, and b is an integer.
irshift(...)
a = irshift(a, b) -- Same as a >>= b.
isCallable(...)
isCallable(a) -- Same as callable(a).
isMappingType(...)
isMappingType(a) -- Return True if a has a mapping type, False otherwise.
isNumberType(...)
isNumberType(a) -- Return True if a has a numeric type, False otherwise.
isSequenceType(...)
isSequenceType(a) -- Return True if a has a sequence type, False otherwise.
is_(...)
is_(a, b) -- Same as a is b.
is_not(...)
is_not(a, b) -- Same as a is not b.
isub(...)
a = isub(a, b) -- Same as a -= b.
itruediv(...)
a = itruediv(a, b) -- Same as a /= b when __future__.division is in effect.
ixor(...)
a = ixor(a, b) -- Same as a ^= b.
le(...)
le(a, b) -- Same as a<=b.
lshift(...)
lshift(a, b) -- Same as a << b.
lt(...)
lt(a, b) -- Same as a<b.
mod(...)
mod(a, b) -- Same as a % b.
mul(...)
mul(a, b) -- Same as a * b.
ne(...)
ne(a, b) -- Same as a!=b.
neg(...)
neg(a) -- Same as -a.
not_(...)
not_(a) -- Same as not a.
or_(...)
or_(a, b) -- Same as a | b.
pos(...)
pos(a) -- Same as +a.
pow(...)
pow(a, b) -- Same as a ** b.
repeat(...)
repeat(a, b) -- Return a * b, where a is a sequence, and b is an integer.
rshift(...)
rshift(a, b) -- Same as a >> b.
sequenceIncludes(...)
sequenceIncludes(a, b) -- Same as b in a (note reversed operands; deprecated).
setitem(...)
setitem(a, b, c) -- Same as a[b] = c.
setslice(...)
setslice(a, b, c, d) -- Same as a[b:c] = d.
sub(...)
sub(a, b) -- Same as a - b.
truediv(...)
truediv(a, b) -- Same as a / b when __future__.division is in effect.
truth(...)
truth(a) -- Return True if a is true, False otherwise.
xor(...)
xor(a, b) -- Same as a ^ b.