Created
October 21, 2022 10:53
-
-
Save pudo/adae5884cb29e527b2b8860d03659f52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import ( | |
Generic, | |
Type, | |
TypeVar, | |
) | |
class Statement(object): | |
pass | |
S = TypeVar("S", bound=Statement) | |
class Bla(Generic[S]): | |
def __init__( | |
self, | |
statement_type: Type[S] = Statement, | |
): | |
self.statement_type = statement_type | |
def make(self) -> S: | |
return self.statement_type() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment