comparison example/example.py @ 301:30af90fd46c5

refactor mostly done?
author catherine@dellzilla
date Tue, 26 Jan 2010 18:04:20 -0500
parents dfdbd93a2fae
children 1941e54cb776
comparison
equal deleted inserted replaced
300:1e4773b325d1 301:30af90fd46c5
15 ]) 15 ])
16 def do_speak(self, arg, opts=None): 16 def do_speak(self, arg, opts=None):
17 """Repeats what you tell me to.""" 17 """Repeats what you tell me to."""
18 arg = ''.join(arg) 18 arg = ''.join(arg)
19 if opts.piglatin: 19 if opts.piglatin:
20 arg = '%s%say' % (arg[1:], arg[0]) 20 arg = '%s%say' % (arg[1:].rstrip(), arg[0])
21 if opts.shout: 21 if opts.shout:
22 arg = arg.upper() 22 arg = arg.upper()
23 repetitions = opts.repeat or 1 23 repetitions = opts.repeat or 1
24 for i in range(min(repetitions, self.maxrepeats)): 24 for i in range(min(repetitions, self.maxrepeats)):
25 self.stdout.write(arg) 25 self.stdout.write(arg)