On May 4, 1:32 pm, Terry Reedy wrote:
> On 5/4/2010 1:45 AM, rickhg12hs wrote:
[snip]
> > [To bad there's no tail recursion optimization.] 8-(
>
> That issue is much more complicated than you probably imagine.
[snip]
No imagination is necessary - functional languages (e.g.,
On May 4, 1:34 am, Cameron Simpson wrote:
> On 03May2010 22:02, rickhg12hs wrote:
> | Would a kind soul explain something basic to a python noob?
> |
> | Why doesn't this function always return a list?
> |
> | def recur_trace(x,y):
> | print x,y
> |
Would a kind soul explain something basic to a python noob?
Why doesn't this function always return a list?
def recur_trace(x,y):
print x,y
if not x:
return y
recur_trace(x[1:], y + [x[0]])
Here are a couple sample runs.
>>> print(recur_trace([],[1,2,3]))
[] [1,2,3]
[1,2,3]
So that w