annotate docs/pycon2010/pirate2.py @ 387:43ce9110d5a6

fixed bad indent in setup.py
author Catherine Devlin <catherine.devlin@gmail.com>
date Mon, 24 May 2010 05:27:26 -0400
parents 89e38f922c25
children
rev   line source
337
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
1 from cmd import Cmd
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
2 # using ``do_`` methods
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
3
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
4 class Pirate(Cmd):
351
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents: 338
diff changeset
5 gold = 3
337
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
6 def do_loot(self, arg):
351
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents: 338
diff changeset
7 'Seize booty from a passing ship.'
337
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
8 self.gold += 1
374
89e38f922c25 font sizes up
cat@eee
parents: 351
diff changeset
9 print('Now we gots {0} doubloons'
89e38f922c25 font sizes up
cat@eee
parents: 351
diff changeset
10 .format(self.gold))
337
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
11 def do_drink(self, arg):
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
12 'Drown your sorrrows in rrrum.'
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
13 self.gold -= 1
374
89e38f922c25 font sizes up
cat@eee
parents: 351
diff changeset
14 print('Now we gots {0} doubloons'
89e38f922c25 font sizes up
cat@eee
parents: 351
diff changeset
15 .format(self.gold))
337
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
16
2ce34ad4e520 begin Pycon talk
catherine@Drou
parents:
diff changeset
17 pirate = Pirate()
374
89e38f922c25 font sizes up
cat@eee
parents: 351
diff changeset
18 pirate.cmdloop()