On Tue, Jul 30, 2019 at 6:23 PM Dima Tisnek <dimaqq@gmail.com> wrote:
> MyAlias: TypeAlias = int

Looks like a typed global from
https://www.python.org/dev/peps/pep-0526/#global-and-local-variable-annotations

Which has the upside in this example "MyAlias is int" but I wonder if
there's a downside somewhere, for example, presently this statement is
evaluated at runtime, and ought to fail should `int` not be defined?

Yeah, that's intentional. If you need to reference a type that's not yet defined (but will be later in the file) you put it in quotes, like any other forward reference. It's the same for `MyAlias = TypeAlias[int]`. The only form that doesn't have this is `MyAlias: TypeAlias[int]` but that has the opposite problem -- the alias itself is not defined at runtime and that means it cannot be used in other forms (e.g. TypeDef and base classes).

This question is definitely not settled!

--
--Guido van Rossum (python.org/~guido)
Pronouns: he/him/his (why is my pronoun here?)