Pass variable as final
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 302
- Avg merge
- 23h
- Merged PRs (30d)
- 8
Description
Proposal:
The idea is to be able to pass variables as constants, mimicking c++ or rust behaviour such as. And have this be solely as part of the typings ecosystem. It's extremely helpful when reviewing code, or starting to use new codebases.
Issue opened in cpython repo: #113654
fn my_function(mut changeable: &String, unchangeable: &String) {}
In python I suggest the following:
def my_function(changeable: str, unchangeable: Final[str])-> None:
arguments_that_changes += "world!"
return arguments_that_changes + argument_that_stays_constant
Contributor guide
No contributing guide indexed for this repository
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 reading the linked CPython issue #113654 and reviewing how Final is currently used in Python typing. The proposal needs a settled specification for parameter annotations and an agreed typing-ecosystem change before implementation can be scoped; done would require an accepted design and corresponding repository updates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100