
April 17, 2021
7:07 p.m.
Eh, forget about adding ‘else’. On Sat, Apr 17, 2021 at 04:38 Carl Meyer <carl@oddbird.net> wrote:
On Fri, Apr 16, 2021 at 5:14 PM Guido van Rossum <guido@python.org> wrote:
Or perhaps
type: import a from b import c def f() -> int: pass
Sure, that works too!
(You could even add an 'else:' clause. :-)
Since unlike `if TYPE_CHECKING:`, the semantics of `type:` would be that names defined in it are available at runtime (just lazily), I guess the semantics of the `else` would be that it runs eagerly and any names defined in it take precedence over those defined in `type:` at runtime?
Carl
-- --Guido (mobile)