-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
You should allow to write something like that to indicate there is no return (=void)
@typechecked
def rettest(self) -> None:
print("Hello World")
But Actually
Hello World
Traceback (most recent call last):
[...]
File "[...]/annotation/typed.py", line 500, in wrapper
return _check_return_type(signature, target(*args, **kwargs))
File "[...]/annotation/typed.py", line 477, in _check_return_type
raise TypeError('Incorrect return type')
TypeError: Incorrect return type
is thrown and you had to use
@typechecked
def rettest(self) -> type(None):
print("Hello World")
but writing that is ugly and PEP484 defines that
When used in a type hint, the expression None is considered equivalent to type(None) .
so you should also allow None as type.
This is an alternative to #8 .
Metadata
Metadata
Assignees
Labels
No labels