日本のBingへ
約 100,000 件の結果
リンクを新しいタブで開く
  1. Does Python optimize tail recursion? - Stack Overflow

    2012年11月28日 · I have the following piece of code which fails with the following error: RuntimeError: maximum recursion depth exceeded I attempted to rewrite this to allow for tail …

  2. algorithm - What is tail recursion? - Stack Overflow

    2008年8月29日 · Tail recursion optimization is to remove call stack for the tail recursion call, and instead do a jump, like in a while loop. But if you do use the return value of a recursive call …

  3. Python Tail Recursion "Hack" using While Loop - Stack Overflow

    2020年9月7日 · The Python developers have decided that they prefer the simplicity and debuggability of normal recursion over performance benefits of tail call optimization, even …

  4. python - Tail Recursion Fibonacci - Stack Overflow

    2014年3月1日 · Reading it again it was obvious the correct solution was a tail-recursion. But then again, it still doesn't make much sense, as Python doesn't even support tail-recursion elimination.

  5. What's the big deal with tail-call optimization and why does Python …

    2024年1月2日 · If you intensely want to use recursion for things that might alternatively be expressed as loops, then "tail call optimization" is really a must. However, Guido, Python's …

  6. algorithm - What is tail call optimization? - Stack Overflow

    2012年3月21日 · 987 Tail-call optimization is where you are able to avoid allocating a new stack frame for a function because the calling function will simply return the value that it gets from …

  7. The difference between head & tail recursion - Stack Overflow

    2014年1月29日 · In head recursion, the recursive call, when it happens, comes before other processing in the function (think of it happening at the top, or head, of the function). In tail …

  8. Why is Python recursion so expensive and what can we do about it?

    2021年6月15日 · ² Exceptions to this rule of thumb are certain functional languages that guarantee tail-recursion elimination - such as Haskell - where that rule can be relaxed in case of …

  9. Why is tail recursion optimization faster than normal recursion in …

    2016年5月12日 · 17 While I understand that tail recursion optimization is non-Pythonic, I came up with a quick hack to a question on here that was deleted as soon as a I was ready to post. With …

  10. Using python to implement the tail recursion function

    2022年3月31日 · Note that python does not have tail call optimization, so forcing code to be tail recursive is generally a waste. Do you really need this restriction (e.g. for an exercise) or do you …