Uh oh!
There was an error while loading. Please reload this page.
bpo-41559: Documentation for PEP 612 - #24000
Conversation
@gvanrossum. Sorry, I did the reverse of what I'd initially promised - I was in a writing mood :). Really no hurry to review it though, we have a long way till 3.10 beta. This felt more difficult to write than what I did for PEP 585 and PEP 604 combined! Thinking of useful examples which were also understandable by users and copy-pastable/fully working as is wasn't easy. Maybe this is a sign that the typing module needs some refactoring work by the future Docs WG people. |
Hmm I wonder if we should reorder the PEP-sized what's new items while we're at it. Strange that the current order is PEP 563, 613, 604, 612. |
gvanrossum
left a comment
There was a problem hiding this comment.
Thanks so much for this very thorough doc update! I have just a few nits.
Next, do you want to help fixing the support for this in mypy? There's some code, but it's not working right.
| .. note:: | ||
| A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not | ||
| have correct ``__parameters__`` after substitution because | ||
| :class:`typing.ParamSpec` is intended primarily for static type checking. |
There was a problem hiding this comment.
You don't need to add this to the note, but privately I'm interested in an example where it goes wrong?
There was a problem hiding this comment.
'''This example is from the typing module, though it will behave the same with the builtin GenericAlias'''fromtypingimportParamSpec, TypeVar, GenericP=ParamSpec('P')
T=TypeVar('T')
classX(Generic[P]): ...
# Empty tuple, because T is nested inside that listprint(X[int, str, T].__parameters__)Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-Authored-By: Guido van Rossum <gvanrossum@users.noreply.github.com>
Fidget-Spinner
commented
Dec 31, 2020
You're welcome! Unfortunately I have no clue how mypy works internally, so I don't think I'm the right person for that right now. |
gvanrossum
left a comment
There was a problem hiding this comment.
Everything else is fine now!
Uh oh!
There was an error while loading. Please reload this page.
Fidget-Spinner
commented
Jan 1, 2021
Thank you for taking the time to review this prosaic chunk of text. Getting this approved is an awesome way to start the new year! BTW, |
Please skip news, it shares the same news entry as GH-23702, thanks!
https://bugs.python.org/issue41559