names_unbound error

Unbound variable on some code paths

When a function contains a return <name> statement and the name is assigned in the function body, but only inside conditional branches (e.g. if, while, try), it may be unbound when the return is reached on other paths.

def maybe_assign(flag: bool) -> int:
    if flag:
        result = 42
    return result   # result may be unbound if flag is False → E0019

How to handle it

Every rule is on by default — strict is the default, not a cage. You can dial names_unbound 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/names_unbound