Multimethod on __init__ fails mypy #41
Replies: 2 comments 1 reply
-
|
To override mypy, you can do this: @multimethod # type: ignore |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Thanks. I've also realised that applying multimethod to from multimethod import multimethod
class Test:
@multimethod # type: ignore[misc]
def __init__(self) -> None:
pass
@__init__.register
def _int(self, a: int) -> None:
self.i = a
@__init__.register
def _str(self, a: str) -> None:
self.s = a
class Vanilla:
def __init__(self) -> None:
pass
t0 = Test(1)
reveal_type(t0)
t1 = Vanilla()
reveal_type(t1)Is there any way to get type inference working with multimethod |
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
Uh oh!
There was an error while loading. Please reload this page.
-
With a
test.pycontaining:Can I multimethod an
__init__(and pass mypy)? Sorry if I'm missing anything obvious, I'm just getting started with multiple dispatch.Beta Was this translation helpful? Give feedback.
All reactions