Possibly Pythonic Tail Call Optimization (TCO/TRE)

Marko Rauhamaa marko at pacujo.net
Tue Jul 14 13:43:45 EDT 2015


Steven D'Aprano <steve at pearwood.info>:

> C, in my opinion, is the poster child for how a programming language
> should NOT be designed, and I don't want Python to go down the same
> path. John Regehr writes:
>
> "... there are compilers (like GCC) where integer overflow behaved a
> certain way for many years and then at some point the optimizer got
> just a little bit smarter and integer overflows suddenly and silently
> stopped working as expected. This is perfectly OK as far as the
> standard goes. While it may be unfriendly to developers, it would be
> considered a win by the compiler team because it will increase
> benchmark scores."

The problem there is in the C standard, not the compiler that complies
with the standard.

I don't like the way integer overflows are explicitly undefined in
modern C.

Similarly, I don't like the way tail call behavior is undefined in
Python.

Neither blemish gives me much trouble in practice.


Marko



More information about the Python-list mailing list