Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from abc import ABC
- from typing import Protocol, Type
- class Base(ABC):
- pass
- class Foo(Base):
- pass
- class Bar(Base):
- pass
- class IApp(Protocol):
- foo_or_bar: Type[Base]
- class Application(IApp, ABC):
- def __init__(self, flag):
- if flag:
- self.foo_or_bar = Foo()
- else:
- self.foo_or_bar = Bar()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement