Am 14.03.22 um 15:51 schrieb Sergei Lebedev:

> class C[T, S]:
>     def foo[R=int](self) -> R: pass

Could you clarify what the "=int" part stands for?

A type var default (not currently supported by type vars).


> Some ideas how we could express upper bounds, constraints, and variance: [...]

Wdyt about <= for defining an upper bound and +/- for variance annotations? IIRC both are used at least in Scala and OCaml has +/- for specifying variance and </> for polymorphic variants.

This could work, but I'm not too fond of using too many punctuation characters. Python has always been the antithesis to "line-noise" Perl, and I think "key words" (not necessarily "keywords" from a parser perspective) are more readable and obvious.

* Could we make it work for ParamSpecs?

This is one more reason a decorator syntax could be better:

@paramspec("P")
def foo(*args: P.args, **kwargs: P.kwargs) -> None: ...

 - Sebastian