KotlinIsland / KotlinIsland/basedmypy
A `Unionize` typevar and annotaiton modifier
Open
feature
generic modifier
- Dominant language
- Python
- Stars
- 202
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
```py
T_un = TypeVar("T_un", unionize=True)
def test1(a: T_un, b: T_un): ...
test1("", 1) # T is str | int
class A: ...
class B(A): ...
class C(A): ...
def test2(a: Unionize[T], b: T, c: T): ...
test2("", B, C) # T is str | A
# maybe even this
condition: bool
a: Unionize = 1 if condition else "" # int | str
```
Contributor guide
Research direction
Start with the proposed TypeVar(unionize=True), Unionize[T], and bare Unionize examples in the issue. Define the intended type-inference and annotation semantics, including whether the final example is in scope; done requires an agreed behavior and tests for the shown cases.
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