4 ms·
That's not entirely true. The information from the type annotations is available at runtime. ApiStar takes advantage of this, for example.
by jrs95 9y ago
That's not entirely true. The information from the type annotations is available at runtime. ApiStar takes advantage of this, for example.
- ubernostrum 9y agoThe information from annotations is exposed to the runtime, but nothing in the runtime treats them as types or performs any type checking. The feature was introduced as a generic way to annotate functions, without being constrained to a single use case (type checking), and all the tools which actually do type-checking based on annotations are third-party.
- randyrand 9y agoC++ also does do any type checking at runtime. Compile time checking is all that really matters.
- ubernostrum 9y agoThe CPython implementation does have a "compile" step (to produce bytecode, which is what actually gets executed, by a simple stack-based virtual machine), and does not do any type checking in that step no matter how many annotations you give it.