BSK-E0044 error

Final used in an invalid position

PEP 591 restricts FinalT to:

- Module-level variable annotations (x: Finalint = 1) - Class body attribute annotations (VALUE: Finalint = 1) - Instance attribute annotations in __init__ (self.x: Finalint = 1)

The following are all errors:

1. Final used in a function parameter annotation 2. Final nested inside another type constructor (e.g. listFinal[int]) 3. FinalClassVar[...] or ClassVarFinal[...] — mutually exclusive 4. FinalT1, T2 — more than one type argument 5. Bare Final (no type arg, no initializer) at module level

x: list[Final[int]] = []    # E — Final nested in list
def f(x: Final[int]): ...   # E — Final in param
VALUE2: ClassVar[Final] = 1 # E — Final with ClassVar
BAD1: Final                  # E — bare Final, no assignment
BAD2: Final[str, int] = ""  # E — too many type args

How to handle it

Every rule is on by default — strict is the default, not a cage. You can dial BSK-E0044 down per-file or per-path from your editor or pyproject.toml, or fix the code so it type-checks. See the Type System rules and the complete diagnostic reference.

Canonical URL: https://www.basilisk-python.dev/errors/BSK-E0044