Possibly Pythonic Tail Call Optimization (TCO/TRE)

Ned Batchelder ned at nedbatchelder.com
Wed Jul 15 07:12:59 EDT 2015


On Wednesday, July 15, 2015 at 6:56:10 AM UTC-4, Marko Rauhamaa wrote:
> Ned Batchelder <ned at nedbatchelder.com>:
> 
> > On Wednesday, July 15, 2015 at 2:44:55 AM UTC-4, Marko Rauhamaa wrote:
> >> The other problem for tail call elimination is the requirement that
> >> functions return None by default. Smooth tail call elimination would
> >> require that Python leave the default return value unspecified.
> >
> > I don't understand this, can you explain more? Are you saying that the
> > Python specification shouldn't specify what x becomes?:
> >
> >     def who_knows():
> >         pass
> >
> >     x = who_knows()
> 
> Yes, that's what I'm saying. The implementation would be free to assign
> any value whatsoever to x.

I don't understand why that is helpful for TCE?  Can you explain?  How does
specifying None make "smooth TCE" difficult?

--Ned.



More information about the Python-list mailing list