David Brownman on Nostr: npub1e7vnd…5flg9 your escape hatches here are: 1. Hiding incompatible imports under ...
npub1e7vndtpf0s9pcg6yxkmvwvfq2g56rg5694nlgthwg7j2hkjgeuwq65flg9 (npub1e7v…flg9) your escape hatches here are:
1. Hiding incompatible imports under a typing.TYPE_CHECKING conditional (which is always false at runtime)
2. Put uses of those imports in a string annotation, e.g. `a: 'MyType'`
It's no difference to the type checker but has no runtime implication.
I just did this here: https://github.com/xavdid/reddit-user-to-sqlite/blob/main/reddit_user_to_sqlite/reddit_api.py
Check out use of `NotRequired` (only available in 3.10+)
1. Hiding incompatible imports under a typing.TYPE_CHECKING conditional (which is always false at runtime)
2. Put uses of those imports in a string annotation, e.g. `a: 'MyType'`
It's no difference to the type checker but has no runtime implication.
I just did this here: https://github.com/xavdid/reddit-user-to-sqlite/blob/main/reddit_user_to_sqlite/reddit_api.py
Check out use of `NotRequired` (only available in 3.10+)