|
|
|
|
|
by _carljm
380 days ago
|
|
There are ways to type invariant generics more precisely that still meet the gradual guarantee. E.g.: x = [] # list[Unknown]
x.append(A()) # list[Unknown | A]
takes_list_of_a_or_b(x) # list[A | B]
We haven't decided yet if this is what we want to do, though. It's also possible that we may decide to compromise on the gradual guarantee in this area. It's not an ironclad rule for us, just something we're considering as a factor. |
|