This suggestion is so obvious that it's likely has been discussed, but I
can't find any reference (It's not what PEP-3124 talks about).
Generic class syntax, now:
_T_co = TypeVar('_T', covariant=True)
def __contains__(self, x: _T_co) -> bool: ...
(yes it's object in reality)
Generic class syntax, suggested:
def __contains__(self, x: T) -> bool: ...
The + signifies covariant type, as in Scala. The need for underscore prefix
and explicit name for covariant types is gone, since it's class-scoped.
The + is a bit cryptic, but so are term "covariant" and Generic[_T_co]. The
syntax by large is exactly what users coming from statically-typed
languages will expect.
Giving a bound can be done using "T <: AnyStr", "T: AnyStr" or any other
Again, I assume it was discussed before, but my Google skills are failing
me; a pointer will be helpful.
Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/