4 ms·
Are they evaluated at runtime? Or just when the bytecode is generated? (Is that considered runtime?)
by kamikaz1k 3y ago
Are they evaluated at runtime? Or just when the bytecode is generated? (Is that considered runtime?)
- lawrencejgd 3y agoThey're evaluated at runtime, but CPython never checks if type hints are right or not. If you use "from __future__ import annotations" then they're converted to strings, so they could even have references to objects that don't exists (this is for a better performance).