EN: The client code can run visitor operations over any set of elements without figuring out their concrete classes. The accept operation directs a call to the appropriate operation in the visitor object. RU: Клиентский код может выполнять операции посетителя над любым набором
(components: List[Component], visitor: Visitor)
| 136 | |
| 137 | |
| 138 | def client_code(components: List[Component], visitor: Visitor) -> None: |
| 139 | """ |
| 140 | EN: The client code can run visitor operations over any set of elements |
| 141 | without figuring out their concrete classes. The accept operation directs a |
| 142 | call to the appropriate operation in the visitor object. |
| 143 | |
| 144 | RU: Клиентский код может выполнять операции посетителя над любым набором |
| 145 | элементов, не выясняя их конкретных классов. Операция принятия направляет |
| 146 | вызов к соответствующей операции в объекте посетителя. |
| 147 | """ |
| 148 | |
| 149 | # ... |
| 150 | for component in components: |
| 151 | component.accept(visitor) |
| 152 | # ... |
| 153 | |
| 154 | |
| 155 | if __name__ == "__main__": |