-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
Expose DataclassInstance #115
Comments
I'd like it exposed too, as with the latest mypy I'm getting things like:
For reference here from the linked issue, it seems there's currently some differences in how this is handled between type checkers (pyright specifically), which is why it's not exposed yet. |
There's always the good-old from typing import TypeVar, TYPE_CHECKING
if TYPE_CHECKING:
from _typeshed import DataclassInstance
DataclassT = TypeVar("DataclassT", bound="DataclassInstance")
Also it's still pretty new, and new things in the |
Our general principle is to only add things that are in |
One solution would be for
What do you think? |
That would mean people can write |
I agree with Jelle -- that sounds like an odd approach to me. I would just do the same thing as we did for Anyway, that whole discussion seems pretty off-topic for this issue tracker, and should probably be discussed over at python/typing (or the CPython issue tracker) rather than here. |
Yes, but that's already baked into the dataclass-maker standard (
Right, that's basically what I'm suggesting, but once you have the ABC, you may as well make directly inheriting from it work as well, no? Also, you don't really need toe
Sure, where would you like me to post it? |
I'd probably suggest adding an
CPython works I guess, since the concrete proposal is to add something to the standard library. |
Closing this following the policy to only include things that are in CPython or in a PEP. Let's get it into CPython first. |
Just wanted to track this so that I can update my code if it happens.
There are various times when it's necessary to annotate something as a dataclass including
Therefore, it would be very convenient to eventually expose
DataclassInstance
. Suggested here python/typeshed#9362 (comment), and moved to_typeshed
here: python/typeshed#9676.The text was updated successfully, but these errors were encountered: