MCPcopy Create free account
hub / github.com/RefactoringGuru/design-patterns-python / __init__

Method __init__

src/Strategy/Conceptual/main.py:27–36  ·  view source on GitHub ↗

EN: Usually, the Context accepts a strategy through the constructor, but also provides a setter to change it at runtime. RU: Обычно Контекст принимает стратегию через конструктор, а также предоставляет сеттер для её изменения во время выполнения.

(self, strategy: Strategy)

Source from the content-addressed store, hash-verified

25 """
26
27 def __init__(self, strategy: Strategy) -> None:
28 """
29 EN: Usually, the Context accepts a strategy through the constructor, but
30 also provides a setter to change it at runtime.
31
32 RU: Обычно Контекст принимает стратегию через конструктор, а также
33 предоставляет сеттер для её изменения во время выполнения.
34 """
35
36 self._strategy = strategy
37
38 @property
39 def strategy(self) -> Strategy:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected