How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

Chris Angelico rosuav at gmail.com
Fri Aug 7 12:45:02 EDT 2020


On Sat, Aug 8, 2020 at 2:21 AM <2QdxY4RzWzUUiLuE at potatochowder.com> wrote:
>
> On 2020-08-07 at 17:55:45 +0200,
> Marco Sulla <Marco.Sulla.Python at gmail.com> wrote:
> > @Chris: note that "real" recursion in Python is not possible, since
> > there's no support for tail recursion. Maybe something similar can be
> > done using async functions.
>
> Python has real recursion.  Whether or not there's tail recursion on the
> inside is an implementation detail.

More specifically: Python has real recursion. Whether or not tail
recursion is optimized away is an implementation detail.

Tail call optimization (there's no reason to restrict it to recursion
alone) is something a Python implementation could choose to do, but
the trouble is that full optimization tends to destroy traceback
information, so it's often not worth doing. And the cases where
partial optimization is of value just aren't compelling enough for
anyone to implement it into CPython, nor any other major
implementation (to my knowledge). The biggest uses for TCO tend to be
the situations where recursion is the wrong solution to the problem.

But recursion? Recursion is definitely possible.

ChrisA


More information about the Python-list mailing list