Closed rchiodo closed 9 months ago
Thanks, we'll discuss the PEP and come back with our recommendation.
The procedure is that we discuss the PEP, come up with a recommendation, and post it here. Then you'll have to go the Steering Council for a decision, and in the issue asking for an SC decision include our recommendation.
Sorry, for being late for the discussion.
We think it is unlikley that such user-defined type guards exist in real-world code. The mypy primer results didn’t uncover any such cases.
I have such samples a lot in my projects. I was advocating for using this style of code for creating domain specific code that it is fully type safe. And I still am :)
I don't think that braking such use-cases is a good idea without any proposed alternatives.
For example, how would you rewrite this sample with TypeGuard
and TypedDict
without using cast
or type: ignore
(which make your code unsafe)? https://mypy-play.net/?mypy=latest&python=3.12&gist=b920fd2157097662a636267bfd0518e1
@sobolevn thanks for the contribution, but to avoid fragmenting the discussion, let's keep any discussion off this tracker and please post on Discuss (https://discuss.python.org/t/pep-724-stricter-type-guards/34124) instead. We'll definitely take your views into consideration.
The Typing Council was unable to come to unanimous agreement on PEP 724. The TC members are in agreement that the “strict semantics” described in PEP 724 are useful and address feedback from developers about the original TypeGuard (introduced in PEP 647). There was disagreement about whether to modify the existing TypeGuard semantics (as proposed in PEP 724) or introduce a new special form that offers different semantics from the original TypeGuard. The majority of TC members are concerned about the backward compatibility implications of modifying the existing TypeGuard semantics and therefore recommend an approach that differs from the current PEP’s proposal. The authors of the PEP have consequently decided to withdraw PEP 724. This opens the door for alternative proposals to be put forth.
Hi, I'm trying this out as a way to ask the typing council to take a look at a typing based pep: https://peps.python.org/pep-0724/