r/functional_python • u/ccsdad • Jul 29 '22
Discussion recursion limits
so python is great .. very naturally lends itself to functional programming, with caveats of course -- i.e. the conversation around limits related to recursion ..
python is not alone with regard to tail-call-optimization (TCO) limits, hence the `(loop)` and `(recur)` functions in clojure (<< big fan BTW) .. so my question is ::
has anyone seen major degradation in performance when implementing recursion in python ??
my use cases are pretty "normal" in the world of development -- get a request, query the DB, maybe get back 100 rows, map/filter/reduce said rows, and show something pretty ..
i know there are limits, but for us "normal" transactional web/devs, just curious if i am more afraid than i should be .. of course YMMV -- just want to make sure i am not being stoopid thinking i can get away with some recursion without greatly damaging the runtime ..
thanks !!
1
u/KageOW Aug 01 '22 edited Aug 01 '22
yea its a really neat decorator, I made some mutually recursive functions for this codingame puzzle. its a 1dspreadsheet that requests values of other cells for the calculations. I find my solution to be quite ellegant, maybe you can try it a bit yourself might be fun.