RSS feed
[root]
/
c06
/
code
/
TI Python
/
scripts
/
document
login:
password:
title search:
Search this site
Enter your search terms
Web
www.carfield.com.hk
Submit search form
Prev
Next
Wed Dec 26 16:00:00 GMT 2001
CommandPattern
#: c06:CommandPattern.py class Command: def execute(self): pass class Loony(Command): def execute(self): print "You're a loony." class NewBrain(Command): def execute(self): print "You might even need a new brain." class Afford(Command): def execute(self): print "I couldn't afford a whole new brain." # An object that holds commands: class Macro: def __init__(self): self.commands = [] def add(self, command): self.commands.append(command) def run(self): for c in self.commands: c.execute() macro = Macro() macro.add(Loony()) macro.add(NewBrain()) macro.add(Afford()) macro.run() #:~
(google search)
(amazon search)
1
2
3
second
download zip of files only
Prev
Next