Skip to content

Type narrowing after inspect.iscoroutinefunction #1821

Answered by erictraut
petrusek asked this question in Q&A
Discussion options

You must be logged in to vote

No, pyright doesn't currently know about inspect.iscoroutinefunction for type narrowing. The full list of supported type guards can be found here: https://github.com/microsoft/pyright/blob/master/docs/type-concepts.md#type-guards.

We do occasionally add support for new type guards, but every case requires specialized logic and adds complexity (and in some cases degrades overall analysis performance), so we have a high bar for which cases to support. That means we need evidence that it's a frequently-used idiom in Python code and would benefit some reasonable number of pyright users. That evidence usually takes the form of:

  1. A significant number of upvotes in issues like this
  2. Evidence that…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@erictraut
Comment options

@petrusek
Comment options

@erictraut
Comment options

Answer selected by petrusek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants