3 ms·
Just checked PEP3107 and PEP484 and type hints are not taken into account at runtime[1]. > While these annotations are available at runtime through the usual _
by ptsneves 4y ago
Just checked PEP3107 and PEP484 and type hints are not taken into account at runtime[1].
> While these annotations are available at runtime through the usual __annotations__ attribute, no type checking happens at runtime.
At first I thought it was disproving the commenter's "strange take" assertion but it actually proves him right. While it is true that python's type hints are a build time feature like in Rust, they do not generate code for the interpreter in the way Rust does.
Actually they do not generate anything besides metadata that can be interpreted (at build time) in any way undefined way. The undefined is explicit.
I personally liked the article and agree that eventually the undefined specification of the PEP will be removed and a new language a-la Typescript will emerge.
[1] https://peps.python.org/pep-0484/ https://peps.python.org/pep-0484/