Skip to content
Discussion options

You must be logged in to vote

By default, pyright doesn't report any errors with the above code. I'm guessing that you've enabled strict-mode type checking?

One option that you haven't listed above is to write your own user-defined type guard function using TypeIs:

def is_tuple(val: object) -> TypeIs[tuple[Any, ...]]:
    return isinstance(val, tuple)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@aakhavanQC
Comment options

@aakhavanQC
Comment options

Answer selected by aakhavanQC
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