treat uppercase variables as `Final`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Feature
A = 1
A = 2
make A be treated as
from typing import Final
A: Final = 1
A = 2
thus, it will emit error with
test.py:1: error: Cannot assign to final name "A" (because it is uppercase)
Found 1 error in 1 file (checked 1 source file)
Pitch
It would be convenient to not add Final to uppercase variables.
Since pep 8 states that constants are named with uppercase, uppercase variables could be considered Final.

Pylance also uses this convention and warns when UPPERCASE variables are mutated.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how mypy currently handles assignments to names annotated with typing.Final, then compare that path with the uppercase-constant convention described in the issue. Use the test.py examples as the behavioral cases: an uppercase name initialized once should be treated as final, and a later assignment should produce the shown error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100