GH-103721: Allow defining GenericAlias-like things#103722
GH-103721: Allow defining GenericAlias-like things#103722adriangb wants to merge 8 commits intopython:mainfrom
Conversation
Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
There was a problem hiding this comment.
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.
Co-authored-by: Alex Waygood <[email protected]>
…Ve-P9.rst Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
sobolevn
left a comment
There was a problem hiding this comment.
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.