>>> from typing import Protocol
>>>
>>>
>>> class Command(Protocol):
...     def execute(self): """Execute command"""
>>>
>>>
>>> class MorseCode:
...     commands: list[Command]
...
...     def __init__(self):
...         self.commands = []
...
...     def add(self, command: Command):
...         self.commands.append(command)
...
...     def send(self):
...         print('Sending message:')
...         for command in self.commands:
...             command.execute()
...         print('STOP')
>>> class A:
...     def execute(self):
...         print('.-', end=' ')
>>>
>>> class B:
...     def execute(self):
...         print('-...', end=' ')
>>>
>>> class C:
...     def execute(self):
...         print('-.-.', end=' ')
>>>
>>> class D:
...     def execute(self):
...         print('-..', end=' ')
>>>
>>> class E:
...     def execute(self):
...         print('.', end=' ')
>>>
>>> class F:
...     def execute(self):
...         print('..-.', end=' ')
>>>
>>> class G:
...     def execute(self):
...         print('--.', end=' ')
>>>
>>> class H:
...     def execute(self):
...         print('....', end=' ')
>>>
>>> class I:
...     def execute(self):
...         print('..', end=' ')
>>>
>>> class J:
...     def execute(self):
...         print('.---', end=' ')
>>>
>>> class K:
...     def execute(self):
...         print('-.-', end=' ')
>>>
>>> class L:
...     def execute(self):
...         print('.-..', end=' ')
>>>
>>> class M:
...     def execute(self):
...         print('--', end=' ')
>>>
>>> class N:
...     def execute(self):
...         print('-.', end=' ')
>>>
>>> class O:
...     def execute(self):
...         print('---', end=' ')
>>>
>>> class P:
...     def execute(self):
...         print('.--.', end=' ')
>>>
>>> class Q:
...     def execute(self):
...         print('--.-', end=' ')
>>>
>>> class R:
...     def execute(self):
...         print('.-.', end=' ')
>>>
>>> class S:
...     def execute(self):
...         print('...', end=' ')
>>>
>>> class T:
...     def execute(self):
...         print('-', end=' ')
>>>
>>> class U:
...     def execute(self):
...         print('..-', end=' ')
>>>
>>> class V:
...     def execute(self):
...         print('...-', end=' ')
>>>
>>> class W:
...     def execute(self):
...         print('.--', end=' ')
>>>
>>> class X:
...     def execute(self):
...         print('-..-', end=' ')
>>>
>>> class Y:
...     def execute(self):
...         print('-.--', end=' ')
>>>
>>> class Z:
...     def execute(self):
...         print('--..', end=' ')
>>> message = MorseCode()
>>>
>>> message.add(S())
>>> message.add(O())
>>> message.add(S())
>>>
>>> message.send()
Sending message:
... --- ... STOP