Why does type checking not work in Python 3?
I have done the following code with type checks or hints:
import typing
def hello(message: str):
pr
Type hints are just hints, they should tell users what the function expects not what it requires. This is explicitly mentioned in the PEP that introduced them: PEP 3107:
Fundamentals of Function Annotations
Before launching into a discussion of the precise ins and outs of Python 3.0's function annotations, let's first talk broadly about what annotations are and are not:
Function annotations, both for parameters and return values, are completely optional.
Function annotations are nothing more than a way of associating arbitrary Python expressions with various parts of a function at compile-time.
By itself, Python does not attach any particular meaning or significance to annotations. [...]