-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Is there a way to type-alias a generic type? #697
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
This will be possible in the future, but is not yet supported by mypy. See #606 and the ambv/typehinting issue it refers to. |
I chatted about this with Guido and he's only planning to support simple aliases like this:
Cases where the type variable is deeply nested in the alias target probably won't be supported. If you care about this, you should probably ask about it on the ambv/typehinting issue. I actually promised to add this feature to PEP 484, but I haven't yet done it... |
This operates by providing default implementations of `__getstate__` and `__setstate__` for extension classes. Our implementations work by storing a `__mypyc_attrs__` tuple in each class that we generate and collecting all of the attributes in it into a dict. Fixes #697.
This operates by providing default implementations of `__getstate__` and `__setstate__` for extension classes. Our implementations work by storing a `__mypyc_attrs__` tuple in each class that we generate and collecting all of the attributes in it into a dict. Fixes #697.
This operates by providing default implementations of `__getstate__` and `__setstate__` for extension classes. Our implementations work by storing a `__mypyc_attrs__` tuple in each class that we generate and collecting all of the attributes in it into a dict. Fixes #697.
Can I write a generic type-aliase so that:
MyBundle[t]
is exactly equivalent toTuple[List[t], t, List[t]]
The text was updated successfully, but these errors were encountered: