2 ms·
Type annotations aren’t equivalent to this check, though, because they’re not enforced at runtime.
by pansa2 6y ago
Type annotations aren’t equivalent to this check, though, because they’re not enforced at runtime.
- h8hawk 6y agoWhy should type annotation be enforced at run time? In statically typed languages there is no type checking at run time, your type system already proved the type of variable.
- pansa2 6y agoBecause Python’s type annotations don’t prove anything. That’s why, for example, they can’t be used to increase the performance of the interpreter.
- ghostwriter 6y ago> That’s why, for example, they can’t be used to increase the performance of the interpreter. They can (as in - there's API for that, the rest is up to a community effort) improve performance of a final program, if type-annotated code is passed through Cython with ``annotation_typing=True`` flag: http://docs.cython.org/en/latest/src/tutorial/pure.html#static-typing http://docs.cython.org/en/latest/src/tutorial/pure.html#stat... https://github.com/cython/cython/issues/1672#issuecomment-295281642 https://github.com/cython/cython/issues/1672#issuecomment-29...