• 0 Posts
  • 6 Comments
Joined 1 year ago
cake
Cake day: July 8th, 2023

help-circle



  • Any time you need different behavior between static type checking and runtime.

    in 3.10 I’m using it to work around issue with NamedTuple generics. typing_extensions.NamedTuple allows Generics at runtime but typing.NamedTuple doesn’t. But the type checker we are using doesn’t support typing_extensions.NamedTuple like it does for the typing version so we lie at type checking time to get the typing to make sense but have different runtime type because otherwise its a TypeError