Is "NoReturn" the proper annotation for global_print_exc()?
The NoReturn type indicates the function either never terminates or always throws an exception:
From PEP-484:
The typing module provides a special type NoReturn to annotate functions that never return normally. For example, a function that unconditionally raises an exception..
By having it set to NoReturn, all the code after the call to global_print_exc() is "dimmed" in type-aware IDEs like VS Code. (For example, NoReturn makes sense for annotating sys.exit() with the visual indication that none of the code after it will ever execute.)
Since the function is simply setting sys.excepthook, shouldn't the return type simply be None, or am I missing something?
Thanks for pointing that! My bad, at the time of implementing it I sincerely thought that "-> None" stands for "return None" while "-> NoReturn" stands for mere "return" ;) Let me fix that in the next version.