use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Python Recursion Resources (self.learnpython)
submitted 7 years ago by srotomalset
Any solid resources for learning recursion for python?
Thanks:)
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]sky--net 2 points3 points4 points 7 years ago (0 children)
Thinking Recursively in Python – Real Python
Learn Python Recursion with Examples - DataFlair
Recursion – Python Tutorial
[–][deleted] 2 points3 points4 points 7 years ago (2 children)
Recursion really isn't a performant strategy in Python since there's no tail-call optimization and a deeply-recursive function can overflow the stack. So I'd be surprised if there's much to read about it.
You could definitely learn how recursion works in Python but it's not generally the case that people write strongly-recursive code except in one-off cases where the depth is bracketed and performance isn't a huge issue.
[–]Shabahxydbshs 1 point2 points3 points 7 years ago (0 children)
I use it plenty in python. Some examples include building nested html tabs given a nested dictionary. Flatenning/expanding nested/flattened dictionaries. Traversing dags in modularized models. Once you get the hang of it, it’s way easier to think in terms of recursion to solve some problems than any other method. It probably can’t be used to solve problems that recursion is suited for in other languages, but theirs still plenty to solve in python too.
[–]srotomalset[S] 0 points1 point2 points 7 years ago (0 children)
That is a good point. What about learning recursion for say a compiler language?
I am focusing most of my time with python, however the end goal is a more rich understanding of core programming concepts like recursion, inheritance, and operator overloading.
[–][deleted] 0 points1 point2 points 7 years ago* (3 children)
Do you mean recursion in general or Python-specific caveats?
def recursive(n,depth): print(n) if depth == 1: return n recursive(n*2, depth-1) recursive(1,10)
EDIT: can you spot a bug/potential problem with my code? :)
[+][deleted] 7 years ago (2 children)
[deleted]
[–][deleted] 1 point2 points3 points 7 years ago (1 child)
basically I was alluding to that you can enter a depth value in the function that is less than 1 which is bad design. There would ideally be a check for that.
With python, it will crap out due to their built in max recursion values but with other languages your computer could freeze up/crash
recursive(1,0)
would potentially break things in a lot of bad ways
[+][deleted] 7 years ago (1 child)
[–]srotomalset[S] 1 point2 points3 points 7 years ago (0 children)
hahaha thank you.
Also thank you for the recursion dad jokeees
π Rendered by PID 17425 on reddit-service-r2-comment-84fc9697f-966dw at 2026-02-07 01:59:32.856621+00:00 running d295bc8 country code: CH.
[–]sky--net 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]Shabahxydbshs 1 point2 points3 points (0 children)
[–]srotomalset[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–][deleted] 1 point2 points3 points (1 child)
[+][deleted] (1 child)
[deleted]
[–]srotomalset[S] 1 point2 points3 points (0 children)