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()
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.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.