NoReturn vs. None in “void” functions - type annotations in Python 3.6
问题 Python 3.6 supports type annotation, like: def foo() -> int: return 42 But what is expected to use when a function hasn't return anything? PEP484 examples mostly use None as a return type, but there is also NoReturn type from typing package. So, the question is what is preferable to use and what is considered a best practice: def foo() -> None: #do smth or from typing import NoReturn def foo() -> NoReturn: #do smth 回答1: NoReturn means the function never returns a value . The function either