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

Method strategy

src/Strategy/Conceptual/main.py:39–50  ·  view source on GitHub ↗

EN: The Context maintains a reference to one of the Strategy objects. The Context does not know the concrete class of a strategy. It should work with all strategies via the Strategy interface. RU: Контекст хранит ссылку на один из объектов Стратегии. Контекст не

(self)

Source from the content-addressed store, hash-verified

37
38 @property
39 def strategy(self) -> Strategy:
40 """
41 EN: The Context maintains a reference to one of the Strategy objects.
42 The Context does not know the concrete class of a strategy. It should
43 work with all strategies via the Strategy interface.
44
45 RU: Контекст хранит ссылку на один из объектов Стратегии. Контекст не
46 знает конкретного класса стратегии. Он должен работать со всеми
47 стратегиями через интерфейс Стратегии.
48 """
49
50 return self._strategy
51
52 @strategy.setter
53 def strategy(self, strategy: Strategy) -> None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected