blob: 2d3ca36c5108dea18a5edcd68b1c493d34c44871 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
from twisted.protocols import amp
from ampoule import child
def fib(n):
if n <= 2:
return 1
else:
return fib(n-1) + fib(n-2)
class Fib(amp.Command):
response = [("fib", amp.Integer())]
class FibCalculator(child.AMPChild):
@Fib.responder
def fib(self):
print 'called responder, fib...'
return {"fib": fib(25)}
|