python / typing-council

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

Typing spec update for named tuples #17

Closed erictraut closed 6 months ago

erictraut commented 6 months ago

I'd like to request that the TC consider adoption of a new chapter in the typing spec that spells out type checking behaviors related to named tuples.

Links to PR & Discussion The PR can be found here. The latest draft incorporates feedback from PR reviews and the discussion.

The discussion can be found here.

TC Sign-off

Current Type Checker Behaviors The proposed chapter specifies several required behaviors for type checkers along with some optional behaviors.

The latest published version of pyright (1.1.349) mostly conforms to the proposed spec but misses a few errors (false negatives).

The latest published version of mypy (1.8.0) mostly conforms to the proposed spec but likewise misses a few errors (false negatives).

I haven't done a detailed analysis of pyre or pytype, but I assume that they largely conform with the required parts of the proposed spec.

Controversial Issues I'm not aware of any controversial issues or compatibility issues associated with the proposed spec.

erictraut commented 6 months ago

I've written a draft version of conformance tests for this chapter: https://github.com/python/typing/pull/1616.

As I expected, the four major type checkers largely comply, but the tests did uncover a few bugs and missing errors (false negatives).

gvanrossum commented 6 months ago

Thanks for the spec. It's very nice. I checked my box.

erictraut commented 6 months ago

This spec modification has been adopted by the TC.