pytypes
pytypes copied to clipboard
Ellipsis not working in Callable annotation
The following code:
from typing import Callable
from pytypes import TypeChecker
def n() -> str:
return "OK"
def f() -> Callable[..., str]:
return n
with TypeChecker():
print(f()())
fails as follows:
$ python3 Test.py
/usr/local/lib/python3.6/dist-packages/pytypes-1.0b5.post23-py3.6.egg/pytypes/type_util.py:2534: UserWarning: the system profiling hook has changed unexpectedly
warn('the system profiling hook has changed unexpectedly')
Traceback (most recent call last):
File "Test.py", line 12, in <module>
print(f()())
File "Test.py", line 8, in f
def f() -> Callable[..., str]:
TypeError: Callable[[arg, ...], result]: each arg must be a type. Got Ellipsis.
Ellipsis is also not supported for tuples. E.g., Tuple[int, ...]
. It would be very nice to get that supported!