Document how joins work
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- documentation
Research direction
Start by locating the mypy documentation covering type inference for collections and related typing behavior. Use the A, B, and C example from the issue to verify how inferred common base classes differ from an explicitly annotated Union. Done means the behavior is explained with accessible examples without relying heavily on the term “join”.
Written by the indexing model from the issue text.
Description
Joins tend to produce common base classes instead of unions, and this may be surprising. I don't think that this is documented, at least not very clearly. The discussion probably shouldn't rely heavily on the relatively obscure term "join" (especially as the operation technically isn't quite a lattice join) -- rather we can use examples and more informal explanations.
Typical example where this is relevant:
class A: pass
class B(A): pass
class C(A): pass
x = [B(), C()] # Inferrred type List[A], not List[Union[B, C]]
y: List[Union[B, C]]
y = [B(), C()] # Now the type is List[Union[B, C]]
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 54
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.
More from python/mypy
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug topic-configuration topic-error-reporting
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#117848 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100