Python and Lisp : car and cdr

Elias Fotinis efotinis at yahoo.com
Sun Jun 19 09:24:37 EDT 2011


On Sun, 19 Jun 2011 15:56:27 +0300, Ethan Furman <ethan at stoneleaf.us> wrote:

> Lie Ryan wrote:
>
>> def length(L):
>>     if not L: return 0
>>     return 1 + length(cdr(L))
>
> How is this different from regular ol' 'len' ?

It's better, because len() can't overflow the stack. ;)




More information about the Python-list mailing list