[issue41559] Add support for PEP 612 to typing.py

2020-12-11 Thread Raymond Hettinger
Change by Raymond Hettinger : -- title: Add support for PEP 612 to typing.py -> Add support for PEP 612 to typing.py ___ Python tracker ___

[issue41559] Add support for PEP 612 to typing.py

2020-12-10 Thread Guido van Rossum
Guido van Rossum added the comment: I started doing this in the original code (long ago when PEP 484 was brand new) but have since realized that this makes the typing module both slow and hard to maintain. We should not follow this example. I do think we should try to keep `__args__` hashable,

[issue41559] Add support for PEP 612 to typing.py

2020-12-10 Thread Ken Jin
Ken Jin added the comment: The pyre version in their __init__.py looks like they took your advice for letting the static checker do the work wholeheartedly. I'm not in favour of type checking either. Just that the pre-existing code does it for me. Not type checking when seeing ~P in

[issue41559] Add support for PEP 612 to typing.py

2020-12-10 Thread Guido van Rossum
Guido van Rossum added the comment: For reference, here's what Pyre has (though it's an older version): https://github.com/facebook/pyre-check/tree/master/pyre_extensions -- ___ Python tracker

[issue41559] Add support for PEP 612 to typing.py

2020-12-10 Thread Guido van Rossum
Guido van Rossum added the comment: > class X(Generic[T, P]): ... > > 1. X[int, [int, bool]] raises TypeError because second arg isn't a type (this > is easy to fix). How would you fix it? By just allowing it? But then X.__args__ would be unhashable (see the other issue we're working on

[issue41559] Add support for PEP 612 to typing.py

2020-12-10 Thread Ken Jin
Ken Jin added the comment: > and was surprised that C.__parameters__ was (T,) instead of (T, P). Alright, I just fixed that :). I'm now encountering many problems with how typing works which prevent what PEP 612 declare as valid from not throwing an error (these are all examples copied from

[issue41559] Add support for PEP 612 to typing.py

2020-12-09 Thread Guido van Rossum
Guido van Rossum added the comment: I wrote class C(Generic[T, P]): ... and was surprised that C.__parameters__ was (T,) instead of (T, P). -- ___ Python tracker ___

[issue41559] Add support for PEP 612 to typing.py

2020-12-08 Thread Ken Jin
Ken Jin added the comment: I have a one question: Should ParamSpec be treated as a type of TypeVar? This mostly pertains to adding it to __parameters__ of generic aliases. Type substitution/chaining, seems inappropiate for it right now. Thanks for your help! --

[issue41559] Add support for PEP 612 to typing.py

2020-12-08 Thread Guido van Rossum
Guido van Rossum added the comment: Thanks for working on this -- let me know when you have a question for me. Once this is ready we should also add it to the typing_extensions module so people can use it on older Python versions.

[issue41559] Add support for PEP 612 to typing.py

2020-12-08 Thread Ken Jin
Change by Ken Jin : -- keywords: +patch nosy: +kj nosy_count: 1.0 -> 2.0 pull_requests: +22569 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/23702 ___ Python tracker

[issue41559] Add support for PEP 612 to typing.py

2020-08-15 Thread Guido van Rossum
New submission from Guido van Rossum : We need stub versions of ParamSpec and Concatenate added to typing.py, plus tests that ensure these actually work in all situations required by the PEP. (It's not so important to ensure that they raise exceptions at runtime in cases where the PEP says