3 ms·
Since it does no checking of the annotations at runtime: I don't really think this is accurate. This prints `5` for instance: https://repl.it/repls/DarkorchidF
by Groxx 7y ago
Since it does no checking of the annotations at runtime: I don't really think this is accurate. This prints `5` for instance: https://repl.it/repls/DarkorchidFailingComputationalscience https://repl.it/repls/DarkorchidFailingComputationalscience
def do(s: int) -> str:
return 5
print(do("123"))
Python is duck-typed. Wrong types aren't detected until they fail to quack correctly.
- adsharma 7y agoIf you run mypy or pyre-check on the code above, it'll give you a type error, just like a C compiler would.
- Groxx 7y agoSure, but that's like saying "valgrind exists, so C has out-of-bounds checks". It doesn't. External tools have just found ways to add optional safety that the language lacks.