{
  "id": "python-weakref-table",
  "kind": "table",
  "slug": "python-weakref",
  "iil_id": null,
  "note_url": "https://iinventedlight.com/library/notes/python-weakref/",
  "title": "Python weakref - caches and mappings that do not keep objects alive",
  "columns": [
    "name",
    "source",
    "detail"
  ],
  "rows": [
    {
      "name": "ref(obj[, callback])",
      "source": "Python docs",
      "detail": "weak reference; call it to get the object, or None if no longer alive"
    },
    {
      "name": "WeakValueDictionary",
      "source": "Python docs",
      "detail": "mapping class that references values weakly"
    },
    {
      "name": "WeakKeyDictionary",
      "source": "Python docs",
      "detail": "mapping class that references keys weakly; attach data to objects owned elsewhere"
    },
    {
      "name": "WeakSet",
      "source": "Python docs",
      "detail": "set interface with weak references to its elements"
    },
    {
      "name": "WeakMethod",
      "source": "Python docs",
      "detail": "weak reference to a bound method"
    },
    {
      "name": "finalize(obj, func, ...)",
      "source": "Python docs",
      "detail": "callable finalizer called when obj is garbage collected"
    }
  ],
  "related_slugs": [
    "python-collections-containers",
    "python-functools",
    "python-dataclasses"
  ],
  "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."
}