{
    "mode": "pydoc",
    "parameter": "operator",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/operator/json",
    "generated": "2026-06-02T15:49:07Z",
    "sections": {
        "NAME": {
            "content": "operator - Operator interface.\n",
            "subsections": []
        },
        "MODULE REFERENCE": {
            "content": "https://docs.python.org/3.10/library/operator.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module exports a set of functions implemented in C corresponding\nto the intrinsic operators of Python.  For example, operator.add(x, y)\nis equivalent to the expression x+y.  The function names are those\nused for special methods; variants without leading and trailing\n'' are also provided for convenience.\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "builtins.object\nattrgetter\nitemgetter\nmethodcaller\n",
            "subsections": [
                {
                    "name": "class attrgetter",
                    "content": "|  attrgetter(attr, ...) --> attrgetter object\n|\n|  Return a callable object that fetches the given attribute(s) from its operand.\n|  After f = attrgetter('name'), the call f(r) returns r.name.\n|  After g = attrgetter('name', 'date'), the call g(r) returns (r.name, r.date).\n|  After h = attrgetter('name.first', 'name.last'), the call h(r) returns\n|  (r.name.first, r.name.last).\n|\n|  Methods defined here:\n|\n|  call(self, /, *args, kwargs)\n|      Call self as a function.\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Return state information for pickling\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n"
                },
                {
                    "name": "class itemgetter",
                    "content": "|  itemgetter(item, ...) --> itemgetter object\n|\n|  Return a callable object that fetches the given item(s) from its operand.\n|  After f = itemgetter(2), the call f(r) returns r[2].\n|  After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])\n|\n|  Methods defined here:\n|\n|  call(self, /, *args, kwargs)\n|      Call self as a function.\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Return state information for pickling\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n"
                },
                {
                    "name": "class methodcaller",
                    "content": "|  methodcaller(name, ...) --> methodcaller object\n|\n|  Return a callable object that calls the given method on its operand.\n|  After f = methodcaller('name'), the call f(r) returns r.name().\n|  After g = methodcaller('name', 'date', foo=1), the call g(r) returns\n|  r.name('date', foo=1).\n|\n|  Methods defined here:\n|\n|  call(self, /, *args, kwargs)\n|      Call self as a function.\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Return state information for pickling\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "abs = abs(a, /)\nSame as abs(a).\n\nadd = add(a, b, /)\nSame as a + b.\n\nand = and(a, b, /)\nSame as a & b.\n\nconcat = concat(a, b, /)\nSame as a + b, for a and b sequences.\n\ncontains = contains(a, b, /)\nSame as b in a (note reversed operands).\n\ndelitem = delitem(a, b, /)\nSame as del a[b].\n\neq = eq(a, b, /)\nSame as a == b.\n\nfloordiv = floordiv(a, b, /)\nSame as a // b.\n\nge = ge(a, b, /)\nSame as a >= b.\n\ngetitem = getitem(a, b, /)\nSame as a[b].\n\ngt = gt(a, b, /)\nSame as a > b.\n\niadd = iadd(a, b, /)\nSame as a += b.\n\niand = iand(a, b, /)\nSame as a &= b.\n\niconcat = iconcat(a, b, /)\nSame as a += b, for a and b sequences.\n\nifloordiv = ifloordiv(a, b, /)\nSame as a //= b.\n\nilshift = ilshift(a, b, /)\nSame as a <<= b.\n\nimatmul = imatmul(a, b, /)\nSame as a @= b.\n\nimod = imod(a, b, /)\nSame as a %= b.\n\nimul = imul(a, b, /)\nSame as a *= b.\n\nindex = index(a, /)\nSame as a.index()\n\ninv = inv(a, /)\nSame as ~a.\n\ninvert = invert(a, /)\nSame as ~a.\n\nior = ior(a, b, /)\nSame as a |= b.\n\nipow = ipow(a, b, /)\nSame as a = b.\n\nirshift = irshift(a, b, /)\nSame as a >>= b.\n\nisub = isub(a, b, /)\nSame as a -= b.\n\nitruediv = itruediv(a, b, /)\nSame as a /= b.\n\nixor = ixor(a, b, /)\nSame as a ^= b.\n\nle = le(a, b, /)\nSame as a <= b.\n\nlshift = lshift(a, b, /)\nSame as a << b.\n\nlt = lt(a, b, /)\nSame as a < b.\n\nmatmul = matmul(a, b, /)\nSame as a @ b.\n\nmod = mod(a, b, /)\nSame as a % b.\n\nmul = mul(a, b, /)\nSame as a * b.\n\nne = ne(a, b, /)\nSame as a != b.\n\nneg = neg(a, /)\nSame as -a.\n\nnot = not(a, /)\nSame as not a.\n\nor = or(a, b, /)\nSame as a | b.\n\npos = pos(a, /)\nSame as +a.\n\npow = pow(a, b, /)\nSame as a  b.\n\nrshift = rshift(a, b, /)\nSame as a >> b.\n\nsetitem = setitem(a, b, c, /)\nSame as a[b] = c.\n\nsub = sub(a, b, /)\nSame as a - b.\n\ntruediv = truediv(a, b, /)\nSame as a / b.\n\nxor = xor(a, b, /)\nSame as a ^ b.\n",
            "subsections": [
                {
                    "name": "abs",
                    "content": "Same as abs(a).\n"
                },
                {
                    "name": "add",
                    "content": "Same as a + b.\n"
                },
                {
                    "name": "and_",
                    "content": "Same as a & b.\n"
                },
                {
                    "name": "concat",
                    "content": "Same as a + b, for a and b sequences.\n"
                },
                {
                    "name": "contains",
                    "content": "Same as b in a (note reversed operands).\n"
                },
                {
                    "name": "countOf",
                    "content": "Return the number of items in a which are, or which equal, b.\n"
                },
                {
                    "name": "delitem",
                    "content": "Same as del a[b].\n"
                },
                {
                    "name": "eq",
                    "content": "Same as a == b.\n"
                },
                {
                    "name": "floordiv",
                    "content": "Same as a // b.\n"
                },
                {
                    "name": "ge",
                    "content": "Same as a >= b.\n"
                },
                {
                    "name": "getitem",
                    "content": "Same as a[b].\n"
                },
                {
                    "name": "gt",
                    "content": "Same as a > b.\n"
                },
                {
                    "name": "iadd",
                    "content": "Same as a += b.\n"
                },
                {
                    "name": "iand",
                    "content": "Same as a &= b.\n"
                },
                {
                    "name": "iconcat",
                    "content": "Same as a += b, for a and b sequences.\n"
                },
                {
                    "name": "ifloordiv",
                    "content": "Same as a //= b.\n"
                },
                {
                    "name": "ilshift",
                    "content": "Same as a <<= b.\n"
                },
                {
                    "name": "imatmul",
                    "content": "Same as a @= b.\n"
                },
                {
                    "name": "imod",
                    "content": "Same as a %= b.\n"
                },
                {
                    "name": "imul",
                    "content": "Same as a *= b.\n"
                },
                {
                    "name": "index",
                    "content": "Same as a.index()\n"
                },
                {
                    "name": "indexOf",
                    "content": "Return the first index of b in a.\n"
                },
                {
                    "name": "inv",
                    "content": "Same as ~a.\n"
                },
                {
                    "name": "invert",
                    "content": "Same as ~a.\n"
                },
                {
                    "name": "ior",
                    "content": "Same as a |= b.\n"
                },
                {
                    "name": "ipow",
                    "content": "Same as a = b.\n"
                },
                {
                    "name": "irshift",
                    "content": "Same as a >>= b.\n"
                },
                {
                    "name": "is_",
                    "content": "Same as a is b.\n"
                },
                {
                    "name": "is_not",
                    "content": "Same as a is not b.\n"
                },
                {
                    "name": "isub",
                    "content": "Same as a -= b.\n"
                },
                {
                    "name": "itruediv",
                    "content": "Same as a /= b.\n"
                },
                {
                    "name": "ixor",
                    "content": "Same as a ^= b.\n"
                },
                {
                    "name": "le",
                    "content": "Same as a <= b.\n"
                },
                {
                    "name": "length_hint",
                    "content": "Return an estimate of the number of items in obj.\n\nThis is useful for presizing containers when building from an iterable.\n\nIf the object supports len(), the result will be exact.\nOtherwise, it may over- or under-estimate by an arbitrary amount.\nThe result will be an integer >= 0.\n"
                },
                {
                    "name": "lshift",
                    "content": "Same as a << b.\n"
                },
                {
                    "name": "lt",
                    "content": "Same as a < b.\n"
                },
                {
                    "name": "matmul",
                    "content": "Same as a @ b.\n"
                },
                {
                    "name": "mod",
                    "content": "Same as a % b.\n"
                },
                {
                    "name": "mul",
                    "content": "Same as a * b.\n"
                },
                {
                    "name": "ne",
                    "content": "Same as a != b.\n"
                },
                {
                    "name": "neg",
                    "content": "Same as -a.\n"
                },
                {
                    "name": "not_",
                    "content": "Same as not a.\n"
                },
                {
                    "name": "or_",
                    "content": "Same as a | b.\n"
                },
                {
                    "name": "pos",
                    "content": "Same as +a.\n"
                },
                {
                    "name": "pow",
                    "content": "Same as a  b.\n"
                },
                {
                    "name": "rshift",
                    "content": "Same as a >> b.\n"
                },
                {
                    "name": "setitem",
                    "content": "Same as a[b] = c.\n"
                },
                {
                    "name": "sub",
                    "content": "Same as a - b.\n"
                },
                {
                    "name": "truediv",
                    "content": "Same as a / b.\n"
                },
                {
                    "name": "truth",
                    "content": "Return True if a is true, False otherwise.\n"
                },
                {
                    "name": "xor",
                    "content": "Same as a ^ b.\n"
                }
            ]
        },
        "DATA": {
            "content": "all = ['abs', 'add', 'and', 'attrgetter', 'concat', 'contains', '...\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3.10/operator.py\n\n",
            "subsections": []
        }
    },
    "summary": "operator - Operator interface.",
    "flags": [],
    "examples": [],
    "see_also": []
}