{
  "id": "python-typing-literal-table",
  "kind": "table",
  "slug": "python-typing-literal",
  "iil_id": null,
  "note_url": "https://iinventedlight.com/library/notes/python-typing-literal/",
  "title": "Restrict a type to a specific value with typing.Literal",
  "columns": [
    "name",
    "source",
    "detail"
  ],
  "rows": [
    {
      "name": "Literal",
      "source": "Python PEPs",
      "detail": "Special typing form for literal types"
    },
    {
      "name": "specific value",
      "source": "Python PEPs",
      "detail": "The expression has literally that value"
    },
    {
      "name": "provided literals",
      "source": "Python PEPs",
      "detail": "Value equivalent to one of the provided literals"
    },
    {
      "name": "PEP 586",
      "source": "Python PEPs",
      "detail": "Adds Literal types to the PEP 484 ecosystem"
    }
  ],
  "related_slugs": [
    "python-typing-annotations",
    "python-dataclasses",
    "python-f-strings"
  ],
  "license": "CC-BY-4.0",
  "source_license": "Public-Domain (Python PEPs); PSF-2.0 (Python docs); prose restates cited source lines in own words",
  "as_of": "2026-11-19",
  "status": "deep-draft-20261119",
  "note": "Restated from the note's GREEN sources; check those sources before relying on a value."
}