Skip to content

Instantly share code, notes, and snippets.

@luisenriquecorona
Created March 25, 2020 18:59
Show Gist options
  • Save luisenriquecorona/390c193db7efa2c63cbf3fd6ecf06236 to your computer and use it in GitHub Desktop.
Save luisenriquecorona/390c193db7efa2c63cbf3fd6ecf06236 to your computer and use it in GitHub Desktop.
Building a list from the commands arguments ensures that it is iterable and keeps a local copy of the command references in each MacroCommand instance.
class MacroCommand:
"""A command that executes a list of commands"""
def __init__(self, commands):
self.commands = list(commands) #
def __call__(self):
for command in self.commands: #
command()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment