Last active
December 5, 2023 14:54
-
-
Save maddrum/9a42eafa1ea6c54a5df692c2e768f015 to your computer and use it in GitHub Desktop.
TypeVars
This file contains 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
import typing | |
from abc import ABC | |
_th_base = typing.TypeVar('_th_base', bound='BaseKlass') | |
class BaseKlass(ABC): | |
def __init__(self, selected_topic): | |
self.selected_topics = selected_topics | |
@classmethod | |
def init_from_other(cls, reporter: typing.Type[_th_base]) -> typing.Type[_th_base]: | |
return cls(selected_topics=reporter.selected_topics) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment