Skip to content

Commit 98bb46f

Browse files
author
Guido van Rossum
committed
Clarify what happens if you inherit from Mapping[str, T].
Addresses, but does not fix, #115.
1 parent c29a9b9 commit 98bb46f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pep-0484.txt

+11
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,17 @@ Now ``LinkedList[int]`` is a valid type. Note that we can use ``T``
473473
multiple times in the base class list, as long as we don't use the
474474
same type variable ``T`` multiple times within ``Generic[...]``.
475475

476+
Also consider the following example::
477+
478+
from typing import TypeVar, Mapping
479+
480+
T = TypeVar('T')
481+
482+
class MyDict(Mapping[str, T]):
483+
...
484+
485+
In this case MyDict has a single parameter, T.
486+
476487

477488
Abstract generic types
478489
----------------------

0 commit comments

Comments
 (0)