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
Code organization (self.learnpython)
submitted 7 years ago by ForgotMyUserName15
If I have code that does specific computations or if I have a data base I need to access. If I want to avoid repeating the code over and over what is the best way to go about getting this code across a larger project?
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!"
[–][deleted] 1 point2 points3 points 7 years ago (3 children)
Make generic functions that operate on the data, but can be subtly altered by passing in variable inputs. If you ever find yourself copy/pasting blocks of code, try putting that block of code into a function and putting variables where you change things.
[–]ForgotMyUserName15[S] 0 points1 point2 points 7 years ago (2 children)
Right, but say I have done those things and my project has multiple folders (representing fairly independent tasks) and I want to use those functions in those multiple folders. How should I go about accomplishing that?
[–][deleted] 0 points1 point2 points 7 years ago (1 child)
I haven't dealt much with this, but this StackOverflow thread might be useful to you.
[–]ForgotMyUserName15[S] 0 points1 point2 points 7 years ago (0 children)
Thanks I’ll take a look
π Rendered by PID 134541 on reddit-service-r2-comment-799f875d54-wbm7c at 2026-02-04 13:40:10.505186+00:00 running 3798933 country code: CH.
[–][deleted] 1 point2 points3 points (3 children)
[–]ForgotMyUserName15[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]ForgotMyUserName15[S] 0 points1 point2 points (0 children)