Skip to content

Commit 4e248ff

Browse files
author
Guido van Rossum
committed
Explain that subclassing e.g. Iterable without a parameter means Iterable[Any].
This addresses, but does not fix, issue #85.
1 parent 888299f commit 4e248ff

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pep-0484.txt

+9
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,15 @@ You can use multiple inheritance with ``Generic``::
397397
class LinkedList(Sized, Generic[T]):
398398
...
399399

400+
Subclassing a generic class without specifying type parameters assumes
401+
``Any`` for each position. In the following example, ``MyIterable``
402+
is not generic but implicitly inherits from ``Iterable[Any]``:
403+
404+
from typing import Iterable
405+
406+
class MyIterable(Iterable): # Same as Iterable[Any]
407+
...
408+
400409

401410
Arbitrary generic types as base classes
402411
---------------------------------------

0 commit comments

Comments
 (0)