{
  "id": "python-operator-table",
  "kind": "table",
  "slug": "python-operator",
  "iil_id": null,
  "note_url": "https://iinventedlight.com/library/notes/python-operator/",
  "title": "Python operator - itemgetter, attrgetter, methodcaller and function forms of operators",
  "columns": [
    "name",
    "source",
    "detail"
  ],
  "rows": [
    {
      "name": "itemgetter(2)",
      "source": "Python docs",
      "detail": "fetches item 2 with __getitem__(); several items return a tuple"
    },
    {
      "name": "attrgetter('name')",
      "source": "Python docs",
      "detail": "fetches the attribute; names can contain dots like 'name.first'"
    },
    {
      "name": "methodcaller('name', 'foo', bar=1)",
      "source": "Python docs",
      "detail": "calls obj.name('foo', bar=1)"
    },
    {
      "name": "operator.add(x, y)",
      "source": "Python docs",
      "detail": "is equivalent to the expression x+y."
    },
    {
      "name": "contains(seq, obj)",
      "source": "Python docs",
      "detail": "is obj in seq; concat(seq1, seq2) is seq1 + seq2."
    }
  ],
  "related_slugs": [
    "python-functools",
    "python-itertools",
    "python-list-comprehensions"
  ],
  "license": "CC-BY-4.0",
  "source_license": "PSF-2.0 (Python docs); PSF-2.0 (python/cpython (GitHub)); prose restates cited source lines in own words",
  "as_of": "2026-11-18",
  "status": "fill-draft-20261118",
  "note": "Restated from the note's GREEN sources; check those sources before relying on a value."
}