-
Notifications
You must be signed in to change notification settings - Fork 274
Description
I have a problem with how __extra__ is currently inherited:
>>> class CustomMapping(typing.Mapping): ...
...
>>> issubclass(dict, CustomMapping)
True>>> class CustomDict(typing.Dict): ...
...
>>> issubclass(dict, CustomDict)
TrueThis can't be right.
My initial impression is that __extra__ should only be propagated on parameterization, not when subclassing, and that the concrete types List, Dict, etc. should have their own extras (list, dict, and so on). Thoughts? A tentative patch is here.
Another thing: The module distributed on PyPI still has the issue where a generic doesn't include itself in the subtype's MRO during parameterization. This was fixed for Python 3.5.1 in aab2c59. It would be great if we could get a more recent revision on PyPI as well.
3.5.1:
>>> issubclass(Iterable[int], Iterable)
True3.5.0:
>>> issubclass(Iterable[int], Iterable)
FalseAnd finally, a question: The collections ABC replacements do not provide the abstract (or any other) methods of the originals. In particular, Iterable is technically not abstract at all. Is this intentional or just a temporary state of affairs?