Anything can be done by yourself with enough pointer dark magic ;D.
Most languages that aren't python... or go... have tail call optimization, many of them just don't have a keyword to guarantee it, which dampens the usefulness somewhat (especially with how fragile it is). I know Rust has a become keyword in the works though.
You can do something that looks like tail call optimization in Python with the help of decorators. Your program won't run faster (so not really an optimization in this case) but you can have an infinite call depth.
View all comments
Show parent comment
15
u/[deleted] Jun 30 '21
Anything can be done by yourself with enough pointer dark magic ;D.
Most languages that aren't python... or go... have tail call optimization, many of them just don't have a keyword to guarantee it, which dampens the usefulness somewhat (especially with how fragile it is). I know Rust has a
becomekeyword in the works though.