2 comments

[ 0.93 ms ] story [ 23.0 ms ] thread
I was super interested until I got to the end of the article. The considerable list of gotchas is downright nasty.

One example:

* Applying type annotations may inadvertently defeat Lazy Imports.

- Modules should use from __future__ import annotations

- Use string type annotations for typing.TypeVar() and typing.NewType()

- Wrap type aliases inside a TYPE_CHECKING conditional block

https://github.com/facebookincubator/cinder/blob/cinder/3.8/...

Caveat emptor (buyer beware).

Python at scale doesn't sound fun at all. Having so many opaque required conventions would suck.

Yeah I thought that was a bit odd but guess types are in modules too.

I have done much Python type hinting besides the integral types and I guess they shouldn't cause any issues with lazy importing.