-
Notifications
You must be signed in to change notification settings - Fork 258
Specialized sub-classes of Generic never call __init__ #192
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
Comments
(Update, copied from the CPython bug:) Actually, I just realized why this is. So far so good. Where it gets interesting is that, in general in Python, whenever I think I can fix this by calling The reason, BTW, why it strips the [str] part of the class is because that's what PEP 484 says, in the same section where it says that NodeT and Nodeint are allowed:
So this bit of code is trying to do the right thing but obviously hasn't been tested much, because mypy disallows that syntax. |
See also 37a3dd5 which backports the fix to Python 2. |
See http://bugs.python.org/issue26391 .
"""
A specialized sub-class of a generic type never calls
__init__
when it is instantiated. See below for an example:I would expect Foo[str], Foo[int], etc to be equivalent to Foo at run-time. If this is not the case it might deserve an explicit mention in the docs. At the moment, behaviour is confusing because an instance of Foo is returned that does not have any of its attributes set.
"""
The text was updated successfully, but these errors were encountered: