What you’re describing is type hints, it’s syntactic sugar and not used at all by the interpreter.
For example, this is a “legal” statement:
foo: int = “bar”
Your IDE and linter will complain, but the interpreter just chops the hints off when compiling, and it’s left with foo = “bar”
Kornblumenratte@feddit.org 4 days ago
That’s just a fancy way of commenting on the intended types, no static typing though.
Python will happily execute:
cooligula@sh.itjust.works 4 days ago
But mypy will not accept it :)