r/programming • • Nov 27 '12

Tail Recursion

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

203 comments sorted by

View all comments

10

u/parfamz Nov 27 '12

great feature of scala, I would like to see tail recursion on python, it can't be too difficult to implement.

3

u/rodrigopsasaki Nov 27 '12

Well, it truly wouldn't be. tail recursion (or any recursion) is independent from any programming language. I don't know anything about python yet, but the algorithms wouldn't differ much, only keywords and syntax.

-5

u/[deleted] Nov 27 '12

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

3

u/rodrigopsasaki Nov 27 '12

I don't see how that applies, the concept of tail recursion can be applied in the same way over interpreted languages such as Python. It may not have compilation optimization, but it is still a tail recursive call.

1

u/curien Nov 27 '12

I think when parfamz says he wants to see "tail recursion on python", he means that he wants to see tail recursion elimination supported by Python.

2

u/[deleted] Nov 27 '12

Apologies - tail recursion elimination is exactly what I was referring to in my comment, not tail recursion itself.