PEP 695: Type Parameter Syntax

This is typically where I lose interest in typing discussions. I accept that technically co/contra-variance may be important, but in my experience, no-one except “typing experts” use or understand those terms. Rust has a strong type system, with extensive use of generics, and I don’t recall ever seeing covariance mentioned in the documentation of how Rust’s types work. If Python generic types require you to be familiar with this terminology, then to be blunt, you’ve lost a big chunk of your audience right there. I basically can’t understand any of the rest of your post, although I can (of course) go and look up the docs on TypeVar and covariant. But if all I have is [R, **P] style syntax, I have nothing to look up even.

So all I’m getting in any practical sense at this point is “this is all too complicated, don’t use it”. And that’s coming from a fan of Rust’s typing system, and someone who read Haskell’s typing system and thought “that’s quite cool”. So anything but a “typing skeptic” :wink:

A lot of my work involves doing PR reviews in github’s interface - where there’s no IDE support. And in any case I strongly object to the idea that Python needs IDE support to be usable (I had enough of that with commercial Java environments).

They are familiar with it, typically. That’s my point about typing being optional. If it’s embedded in syntax which isn’t intuitive or easily discoverable, it’s no longer optional - you have to be familiar with it or you’re stuck.

6 Likes