-
Notifications
You must be signed in to change notification settings - Fork 47
@cache.memoize discard the typehint in origin function. #41
Copy link
Copy link
Open
Description
here is my code
@cache.memoize()
def slow(x: int) -> str:
LOGGER.info("调用: %d", x)
return str(x)
def main() -> None:
LOGGER.info("show(1): ")
LOGGER.info(slow(1))
time.sleep(0.3)
LOGGER.info("show(2): ")
LOGGER.info(slow(2))
time.sleep(0.7)
LOGGER.info("show(1): ")
LOGGER.info(slow(1))
LOGGER.info("show(2): ")
LOGGER.info(slow('2'))
what I expect:
[#7#wangx@manjaroamd:other_useful_library[master] $ mypy test_cacheout.py
test_cacheout.py:37: error: Argument 1 to "slow" has incompatible type "str"; expected "int" [arg-type]
Found 1 error in 1 file (checked 1 source file)
what really happened
[#9#wangx@manjaroamd:other_useful_library[master] $ mypy test_cacheout.py
Success: no issues found in 1 source file
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels