[Edu-sig] Re: Py310: recursion with match-case

2021-11-16 Thread Wes Turner
Actually what does that look like with a stack within one function call? Is it always possible to write recursive functions with a stack (in order to avoid and the function call overhead (which includes a locals() dict on a stack anyway for every function call)) "Why is a function/method call

[Edu-sig] Py310: recursion with match-case

2021-11-16 Thread kirby urner
So are we encouraged to use match-case in recursion instead of if-else? It's more readable this way maybe: cubocta310.py: def cubocta(n): """ https://oeis.org/A005902 """ match n: case 0: return 1 case _: return (10*n*n + 2) + cubocta(n - 1) print([cubocta(i)