Re: Pass same parameter in Recursive function

2008-09-03 Thread Diez B. Roggisch
Davy schrieb: On Sep 3, 11:57 am, "Chris Rebert" <[EMAIL PROTECTED]> wrote: Assuming the function is tail-recursive or the "unchanging" arguments are immutable, just use a closure: [SNIP] Hi Chris, Thank you :) Perhaps I should clarify the problem. 1. the function is NOT tail-recursive 2. Yes,

Re: Pass same parameter in Recursive function

2008-09-02 Thread Davy
On Sep 3, 11:57 am, "Chris Rebert" <[EMAIL PROTECTED]> wrote: > Assuming the function is tail-recursive or the "unchanging" arguments > are immutable, just use a closure: [SNIP] Hi Chris, Thank you :) Perhaps I should clarify the problem. 1. the function is NOT tail-recursive 2. Yes, the arguments

Re: Pass same parameter in Recursive function

2008-09-02 Thread Chris Rebert
Assuming the function is tail-recursive or the "unchanging" arguments are immutable, just use a closure: def func(self, x, y, A, B, C): def _func(x,y): return _func(g(A,B,C,x), h(A,B,C,y)) #recurse return _func(x, y) I'm unsure as to the performance impact of this though. - Chris