Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Are they evaluated at runtime? Or just when the bytecode is generated? (Is that considered runtime?)


They'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).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: