A way to constrain initializers #327
Unanswered
KotlinIsland
asked this question in
Ideas
Replies: 1 comment
-
def foo(t: Callable[[], T]) -> T:
return t() from @DetachHead |
Beta Was this translation helpful? Give feedback.
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Mypy don't care about the LSP of an initializer:
But what if that's something you wanted? Specifically this would be good for a zero arg constructor (but there are other concrete usecases)
I wonder how we could achieve this?
We could handle the special case of zero arg pretty easily:
Beta Was this translation helpful? Give feedback.
All reactions