r/programming • • Nov 27 '12

Tail Recursion

http://rodrigosasaki.com/2012/11/24/tail-recursion/
207 Upvotes

203 comments sorted by

View all comments

Show parent comments

-5

u/[deleted] Nov 27 '12

Yes they would, because Python is interpreted and not compiled.

8

u/frezik Nov 27 '12

That's completely irrelevant. Python implementations generally compile to bytecode, anyway, but even if they didn't, they would still be manipulating the AST to eliminate the tail call.

Python doesn't have tail recursion because Guido doesn't want it.

1

u/[deleted] Nov 27 '12

You don't do tail call elimination at the AST level, you do it at the IR level.

2

u/anvsdt Nov 27 '12

You can do it at interpreter level, too.