Re: on a tail-recursive square-and-multiply

2023-11-09 Thread Julieta Shem via Python-list
Julieta Shem writes: [...] > I agree. By the way, I once read or watched an interview with Guido van > Rossum and and he was asked why not to tail-call optimize Python and the > answer he gave --- IIRC --- was that tail-call optimization makes it > harder for a beginner to understand a stack

Re: on a tail-recursive square-and-multiply

2023-11-08 Thread Julieta Shem via Python-list
Greg Ewing writes: > On 8/11/23 2:26 pm, Julieta Shem wrote: >> For the first time I'm trying to write a tail-recursive >> square-and-multiply and, even though it /seems/ to work, I'm not happy >> with what I wrote and I don't seem to understand it so well. > > Step

Re: on a tail-recursive square-and-multiply

2023-11-07 Thread Greg Ewing via Python-list
On 8/11/23 2:26 pm, Julieta Shem wrote: For the first time I'm trying to write a tail-recursive square-and-multiply and, even though it /seems/ to work, I'm not happy with what I wrote and I don't seem to understand it so well. Stepping back a bit, why do you feel the need to write this tail

Re: on a tail-recursive square-and-multiply

2023-11-07 Thread Michael Torrie via Python-list
On 11/7/23 18:26, Julieta Shem via Python-list wrote: > For the first time I'm trying to write a tail-recursive > square-and-multiply and, even though it /seems/ to work, I'm not happy > with what I wrote and I don't seem to understand it so well. > > --8<-

on a tail-recursive square-and-multiply

2023-11-07 Thread Julieta Shem via Python-list
For the first time I'm trying to write a tail-recursive square-and-multiply and, even though it /seems/ to work, I'm not happy with what I wrote and I don't seem to understand it so well. --8<---cut here---start->8--- def sam(b, e, m, acc = 1): if