Function calls in type annotations are “okay” with a few caveats, but those caveats basically explain why they aren’t something in use currently
-
Currently, the specification says that type alias statements shouldn’t use them. This isn’t enforced at runtime, so you can start using them today, and the language there can be changed to “only supported function calls…”
-
They have to be something that has a well defined meaning at both annotation statically, and that when evaluated, resolves to an object that has a useul interpretation when introspected by runtime typechecking tools.
As it’s a function call, it will look different in the case of a forward reference than anything currently expected in a typing related forward reference, but that’s just a matter of tools that use typing needing to be updated, and that is going to be needed no matter what.
Most function calls fail at the second of these, because they aren’t actually meant for annotation use. Because this is proposing an addition to typing (typing_extensions first), this is already a case where typecheckers need to know what it means either way, and having it mean something meaningful at runtime is relatively simple. (Making this a class method that returns an instance of an ExpressiveCallable solves this)