El dom, 24 oct 2021 a las 15:02, Sergei Lebedev (<sergei.a.lebedev@gmail.com>) escribió:
I really like the proposed syntax! Not only does it read better, but it also makes it impossible to create a TypeVar with nonsensical combinations of features, e.g. bound= with value restrictions. Do you think we could go one step further and free users from the need to declare type vars?
That's more difficult because it requires a language-level change so you don't just get a NameError. For example, we could introduce new syntax so that `def concat<T in (str, bytes)>(...)` is valid. There was a talk proposing that at a typing meetup (I think by Pradeep), but it's much harder to introduce new syntax than to just change the behavior of typing.py.

As with the +T/-T proposal, my concern is that unless we put together a deprecation timeline for the existing syntax, we would end up in a situation where users have to learn both variants and tooling developers have to do redundant work to support them.
I'd be OK with deprecating the current behavior once the last version that doesn't have it is EOL. For this proposal (assuming it is implemented in 3.11), that could mean we deprecate bound= after 3.10 is dead. Hopefully users will just naturally gravitate to the new syntax, just like 3.10+ code will naturally use `X | Y` instead of `Union[X, Y]`.