Replies: 1 comment 10 replies
-
PEP 646 is still in "draft" form. It's open for comment and is being considered for inclusion in Python 3.11. We typically try to get ahead of type-related functionality and incorporate support for them in pyright early. This helps find holes in the standard and gives people a chance to play with the new feature even though it isn't yet implemented in the runtime.
The unpack operator in a subscript operator is part of a draft PEP 637 that was rejected for Python 3.10. The authors of PEP 646 are hoping to include the unpack operator within subscript expressions as part of PEP 646, but the So, to answer your question, pyright has full type-checking support for the latest draft of PEP 646. You and others can use it to play around with the functionality and provide feedback on the PEP while it's still in the "accepting comments" phase. |
Beta Was this translation helpful? Give feedback.
-
Looking at dfa5892, pep 646 variadic generics is claimed to be supported.
But my Python 3.10 interpreter doesn't even seem to support the imports, or the syntax, at all, and pyright doesnt recognize it either.
The program below is taken from https://www.python.org/dev/peps/pep-0646/#type-variable-tuples
but there's no TypeVarTuple either in "typing" or "typing_extensions":
the program doesnt even compile, the syntax is not supported:
so...what exactly is the pep-646 support in pyright? within pylance I also see an error like this:
if I change it to this:
then it says the opposite, ha! funny "Expected unpacked TypeVarTuple; use Unpack[Shape] or *ShapePylance"
so...is it like there's some kind of pep-646 mechanism in pyright / pylance but it's basically useless right now? im not understanding why a Python 3 pep has a syntax that the interpreter can't even accept.
Beta Was this translation helpful? Give feedback.
All reactions