Fibonacci: returning a selection of the series

Arnaud Delobelle arnodel at googlemail.com
Sun Aug 29 15:13:29 EDT 2010


Baba <raoulbia at gmail.com> writes:

> my questios:
> - would you agree that recursive is not ideal for generating a list?
> (in this particular case and in general)

In Python that is probably correct in the vast majority of cases for two
reasons:

* lists in Python are implemented as arrays;
* there is no tail call optimisation in Python.

But not necessarily in other languages.  In Lisp for example, recursion
is *the* natural way of generating lists.

-- 
Arnaud



More information about the Python-list mailing list