Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I also don’t think it’s actually tail call optimization, but rather an “unrecurser”.

I’m also not convinced that this actually is worth the effort, considering it’s doing runtime rewriting of Python using Python.





It's a suboptimal implementation but it's interesting for the purpose of transpiling something like Scheme or ML or maybe Purescript to Python.

Historically, suggestions to make Python tail recursive were rejected on the theory that the added stack frames helped debugging, and that Python was supposed to be an imperative language. But it has been dragged into supporting some FP idioms over the years and that has seemed like a good thing.


Certain function calls that were unable to be run in Python can now be run. From that perspective, my thinking was that this was a net good since one can preserve the "clean syntax" from recursion while still being able to access the performance benefits of an iterative solution.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: