-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
GH-103721: Allow defining GenericAlias-like things #103722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two PEP8 nits:
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two more small comments below (wrap to 80 chars for .py
and .rst
files, use Sphinx markup to link to the rest of the docs).
In general, I think this is a reasonable feature to implement, but I think it should probably be documented somewhere in typing.rst
.
Misc/NEWS.d/next/Library/2023-04-23-18-10-10.gh-issue-103721.4Ve-P9.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
…Ve-P9.rst Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am -1 on this, because it can backfire for a lot of tools that rely on the fact that {types,typing}.GenericAlias
(and nothing else) represent generic types.
For example, https://github.com/HypothesisWorks/hypothesis/blob/e33377305225df0a4ee50a1bd55ed801df6d1ea2/hypothesis-python/src/hypothesis/strategies/_internal/types.py#L298 (and in many other places).
I think that this needs more visibility and discussion before getting accepted.
Would those things backfire any more now than they currently do? Clearly, this PR doesn't make everything automatically work for every library. Anything that is currently doing introspection and trying to detect The best alternative to the current implementation/proposal I can think of is to make this stuff more "public" by providing a Protocol, exporting a public |
Let's keep broader discussion about whether this is a good idea to the issue, not this PR. |
Hypothesis only uses More generally, I never want Hypothesis doing something bizzare internally to be a blocker for upstream improvements. I'm perfectly comfortable with |
It seems like improving docs around subclassing |
Uh oh!
There was an error while loading. Please reload this page.