Support for Final-as-default, like Rust
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Feature
If I want to follow "best practices", I've got to put a Final[ ] wrapper around most type hints I use. Could there be a mypy flag to assume every type hint is final unless it's got a Mut[ ] wrapper?
Would probably require a search-replace script to convert a project between the modes, but that doesn't sound too bad.
Pitch
Variables being constant when you won't need to change them is generally regarded as a good idea, right? This would make it easier, like Rust does.
I don't know about any of the mypy internals, but this doesn't strike me as too big a change?
Interface change would be a new --final-as-default flag.
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
No files, tests, or entry points are named. Start by tracing how mypy handles existing Final annotations and command-line flags, then clarify the semantics of --final-as-default and the proposed Mut wrapper; done would require an agreed design and coverage for the new mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100