python / typing-council

Decisions by the Python Typing Council
41 stars 3 forks source link

PEP 696 #12

Closed Yhg1s closed 6 months ago

Yhg1s commented 7 months ago

As you may remember, PEPs 695 and 696 were sent to the Steering Council around the same time. At the time, the SC decided to accept 695 but wait to see the impact and adoption of it before deciding on 696. Since there is now a typing council, and PEP 696 is all about typing (albeit with a grammar change), the SC would like to evalaute it for the SC.

rchen152 commented 6 months ago

The Typing Council recommends accepting PEP 696, "Type Defaults for Type Parameters". The Steering Council previously deferred making a decision on this PEP until it had seen the impact of PEP 695, "Type Parameter Syntax". PEP 695 has been well-received by the typing community, and we believe that PEP 696 builds on the new syntax in a natural way.

The proposed feature improves the usability of generic classes by allowing sensible defaults to be specified for omitted type parameters. The PEP demonstrates the usefulness of this feature with two examples of type definitions in the standard library that would benefit from TypeVar defaults. The PEP allows libraries to evolve their typed interfaces better, since in many cases it would mean authors no longer have to trade off between more accurate typing and new errors and verbosity for existing users. The PEP has been extensively discussed and revised in public typing forums over the past two years and has community support. Reference implementations of the needed runtime and type checker changes are included.