basedmypy
basedmypy copied to clipboard
infer polymorphism
def f(a): # def f[T](a: T) -> T
return a
def find(data: list, predicate: "(...) -> ..."): # find[T](data: list[T], predicate: (T) -> T) -> T
for item in data:
if predicate(item):
return item
raise ValueError
probs many more cases, and maybe we can use ... in the type position to mean "this must be inferable"