Replies: 1 comment 1 reply
-
You're violating a pretty fundamental rule of object-oriented programming here. A base class should not have knowledge of its subclasses, but in your code, |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm hesitating to report this as an issue because I'm feeling somewhat out of my depth with juggling
__new__
at this level - and it might be that I should be using__call__
or something instead to achieve the behavior I'm looking for.Code:
pyright output:
The
reveal_type
s are working perfectly well (in contrast to mypy: python/mypy#17251), but I'm running out of ideas on how to type__new__
and__init__
to pass. It wouldn't really hurt topyright: ignore
and/or set a bunch of the types asAny
, but I feel like getting rid of at least some of the errors above should be possible. Or maybe it requires more than https://typing.readthedocs.io/en/latest/spec/constructors.html, it at least doesn't explicitly mention overloading__new__
.Beta Was this translation helpful? Give feedback.
All reactions