Nicolas Haller wrote at 2022-3-9 10:53 -0500: > ... >The documentation about "user-defined generic types"[1] says that I can >fix some types on a child class (class MyDict(Mapping[str, T]):) but >doesn't say much about the signature of the methods I need to >implement/override on that child class.
I have the fealing that this is a case of (generic type) "specialization". In this setup, `Mapping` would be a generic type with two type variables `K` (the key type) and `V` (the value type). The signatures of its methods would use those type variables. In your example, you specialize the key type to `str` (and leave the value type generic). The signatures of the methods would automatically follow this specialization -- without the need to do anything. -- https://mail.python.org/mailman/listinfo/python-list