Consider making _ have type Any
Open
Nobody has claimed this yet.
feature
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
_ if frequently used as a target location for discarded values. However, Mypy complains if values of different types are discared into it:
def f() -> int: return 1
def g() -> str: return '1'
_ = f()
_ = g()
Could it have type Any no matter what so that the above code works?
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 file or test entry point is specified. Start with the Python reproduction and investigate how mypy infers and reuses the type of _ across consecutive assignments; done means the example type-checks while the intended behavior is covered by tests.
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
- Clearly specified
- Newbie friendliness
- 35/100