This simple loop works just fine:
>>> def loop (i):
i+=i
if 0<i<20:
print i
loop(i)
>>> loop (1)
2
4
8
16
But this one doesn't work and it exits the loop unexpectedly:
>>> from functools import partial
>>> def loop (i):
i+=i
if 0<i<20:
print i
partial(loop,i)
>>> loop(1)
2
>>>
What's the problem? Is there a solution to make it work somehow?
That was just a simple function... My real question is:
Q: How to write a function which is able to loop over itself, each time with only a number of it's arguments? Should I look somewhere else (other than partial) ?