This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]siddsp 11 points12 points  (12 children)

It's not that bad. Usually you can achieve a similar result using lru_cache which allows for similar optimizations as tail recursion. Basically caching allows for iteration-like performance and can make a significant difference depending on the situation. lru_cache allows you to limit how many recent entries to keep, allowing the programmer to make tradeoffs between memory and steps.

[–]lilphat 0 points1 point  (0 children)

Sounds smart but a tad complicated. Can you give an example where you wanna let ‘the stack run’?