News for hackers. Stuff that matters.
Re:Should You Use Upper Bound Version Constraints (In Python)? by flakes on Wednesday April 17, 2024 @03:09AM (#40061440)
> They are not checked at runtime at all. Type declarations are only used for static analyzing tools and not by the runtime.

This is the common usecase, but types certainly are used at runtime by many libraries. Frameworks like FastAPI use the type annotations to declare dependency injection which is resolved during application startup. In other cases like Pydantic, they are used to determine marshalling/unmarshalling strategies.

There are no comments on this comment yet.