MCPcopy Create free account
hub / github.com/ActiveState/code / pow

Function pow

recipes/Python/466320_Another_memoize/recipe-466320.py:52–56  ·  view source on GitHub ↗
(x, p=2)

Source from the content-addressed store, hash-verified

50
51 @memoize
52 def pow(x, p=2):
53 if p==1:
54 return x
55 else:
56 return x * pow(x, p=p-1)
57
58 print [pow(3, p=i) for i in xrange(1, 6)]
59

Callers 12

recipe-466320.pyFile · 0.70
recipe-156453.pyFile · 0.50
bin2decFunction · 0.50
mainFunction · 0.50
PostfixSubEvalFunction · 0.50
recipe-389202.pyFile · 0.50
pevalFunction · 0.50
calcDistanceMethod · 0.50
ca_dataFunction · 0.50
__pow__Method · 0.50
nthMethod · 0.50
powMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected