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

Function myfunc

recipes/Python/491265_Automatic_Recursion/recipe-491265.py:3–9  ·  view source on GitHub ↗
(a,b=1,c=2,d=3,e=4)

Source from the content-addressed store, hash-verified

1# simple dirty trick for automatic recursion: keyword args from locals()
2
3def myfunc(a,b=1,c=2,d=3,e=4):
4 _kwargs=locals().copy() # freeze unconditional at very beginning
5 print locals()
6 if e<=0: return
7 else:
8 _kwargs['e']=e-1
9 myfunc(**_kwargs)
10
11# proper tools for correct/ad-hoc/fast automatic recursion
12

Callers 1

recipe-491265.pyFile · 0.70

Calls 1

copyMethod · 0.45

Tested by

no test coverage detected