Nested Scopes ... next tail recursion?
Joshua Marshall
jmarshal at mathworks.com
Mon May 14 00:44:20 EDT 2001
Tim Peters <tim.one at home.com> wrote:
> [Ronald Legere]
>> ...
>> I wonder if there is any chance of getting tail recusion
>> handled properly in the future?
> Best guess is slim. It's rarely requested, and AFAIK there are no active
> Python developers who program in a style helped by this gimmick. If so, no
> current developer is likely to contribute such a patch.
> BTW, if A calls B calls B calls B blows up, part of "properly" in *Python*
> would likely include generating a traceback as if tail calls had not been
> optimized. May not require a full stack frame for each level, but may
> require that *something* be tucked away at each level, and in that case it
> wouldn't be "proper" by your meaning.
I'd be content with a trace that reflects the proper tail recursion.
It would be something built into (bolted onto?) the semantics of the
language, backward incompatibly; it wouldn't just be an optimization.
Though I guess this would be a backwards incompatible change
regardless of tracebacks.
Although proper tail recursion in Python would bring a smile to my
face, I still can't bring myself to say it's a good idea. In Python
3000 on the other hand...
More information about the Python-list
mailing list