-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inheritance issues with generic collections #202
Comments
|
Updated the typing gpackage to 3.5.1. Please verify that it's to your
liking.
|
Thanks! As for the abstract methods, adding
One option is to just copy everything over during class construction: class GenericMeta(TypingMeta, abc.ABCMeta):
def __new__(cls, name, bases, namespace,
tvars=None, args=None, origin=None, extra=None):
+ if extra and origin is None:
+ for methodname in getattr(extra, '__abstractmethods__', ()):
+ if methodname in extra.__dict__:
+ namespace.setdefault(methodname, extra.__dict__[methodname])
+
self = super().__new__(cls, name, bases, namespace, _root=True) |
I would like to go slow here. I have other priorities (see #203 (comment)). I will eventually get to this but I'm not sure I want to rush anything into 3.5.2 beyond what's already on deck. |
I have a problem with how
__extra__
is currently inherited:This can't be right.
My initial impression is that
__extra__
should only be propagated on parameterization, not when subclassing, and that the concrete typesList
,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:
3.5.0:
And 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?The text was updated successfully, but these errors were encountered: