Created
March 25, 2020 18:59
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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