Possibly Pythonic Tail Call Optimization (TCO/TRE)

Marko Rauhamaa marko at pacujo.net
Tue Jul 14 21:12:01 CEST 2015


Chris Angelico <rosuav at gmail.com>:

> Tail call elimination is necessary to cope with a system of
> programming that has deliberately excluded certain other options (eg
> mutables, in pure functional languages),

Tail call elimination is necessary for the functional programming style.
While Scheme strongly promotes it, functional programming style crops up
in virtually all programming languages nowadays.

> but is not as important in a more fully-featured language.

It is not all that important in Python for idiomatic reasons, not for
some "full-featuredness".

> Scheme needs TCE because of the way you have to write code for Scheme
> to be even capable of executing it; Python doesn't, because you can
> write your code to not need TCE.

You can write Sheme perfectly procedurally, but why would you do that
when you have Python to satisfy your procedural urges?


Marko


More information about the Python-list mailing list