Jordan Greenberg wrote:
...
> >>> def printreverse(lst):
>       if lst:
>               printreverse(lst[1:])
>               print lst[:1][0]

Convoluted way of writing "print lst[0]" !

> >>> printreverse([1,2,3,4])
>
> No good reason at all to do it this way. But recursion is fun.

But there's a good reason not to. Try:

printreverse(range(1000))

Recursion has a maximum depth (of 1000 by default) in Python.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to