4 ms·
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 ma
by metadat 4y ago
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/CinderDoc/lazy_imports.rst#issues-and-gotchas 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.
- jamesfinlayson 4y agoYeah 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.