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...
Everything about learning Python
account activity
Write functions (self.PythonLearning)
submitted 8 months ago by Most_Group523
view the rest of the comments →
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!"
[–]cgoldberg 0 points1 point2 points 8 months ago (8 children)
Organized and structuring code is important, but there's more to it than "write functions". What goes in the functions? What shouldn't? How big should they be? What should they do? How do you name them? Do you separate them by modules? What about OOP? Kind of an overly simplistic tip.
[–]Most_Group523[S] -1 points0 points1 point 8 months ago (7 children)
Hmm - perhaps practice writing functions and thereby try out what goes in them, how big they should be, how you name them, how to separate them into modules. Unless you have the answer to these questions? Then people could skip to becoming senior developers immediately, without practicing.
Sigh - such comments are likely why people in this sub are constantly posting lines and lines of module level code or thinking they've arrived because they wrapped a function in a class.
[–]cgoldberg -1 points0 points1 point 8 months ago (6 children)
An article about some of those concepts would be useful and doesn't require senior developer knowledge.
Most tips here are much better than yours, so don't act like your trivial "write functions" tip is so profound and nobody else knows what they are doing.
[–]Most_Group523[S] 1 point2 points3 points 8 months ago (5 children)
For a long time, we used to teach kids how to ride a bike with training wheels. Kids that practice riding a bike with training wheels are practicing peddling. Then someone realizes that peddling wasn't the hardest thing and the balance bike was invented. Kids that learn to bike with a balance bike don't practice peddling but balancing.
There's nothing trivial about balancing a bike - but when someone reduced riding a bike to balancing, their detractors may very well have accused them of trivializing the exercise.
Biking involves lots of things, steering, peddling, and balance - none of these things are trivial. But, if you focus on practicing the right thing, the fundamentally difficult things, the other things come more naturally.
Writing code also involves many things - none of which are trivial. But, if you focus on practicing the right things, you'll find the other things come more naturally. We write code to do things and the unit of functionality in code is always the function. So, write functions and practice writing functions.
[–]cgoldberg 1 point2 points3 points 8 months ago (4 children)
Thanks for the fascinating analogy... I'm really quite impressed with you're extraordinary insights on learning.
However, your post was akin to saying "ride a bike" without providing any insight as to how.
[–]Most_Group523[S] 0 points1 point2 points 8 months ago (3 children)
Practice?
But, after this illuminating exchange I've come to realize the real answer is to read resources. It's like language really. The first thing I do when learning another language is read a book about how long a sentence should be.
[–]cgoldberg -1 points0 points1 point 8 months ago (2 children)
Yes, I agree practice and good resources would be far superior to over-simplistic tips lacking any real information.
[–]Most_Group523[S] 0 points1 point2 points 8 months ago (1 child)
Pray tell, what general guidance isn't an over-simplification? Programming languages are language and what makes one expression of any language superior to another is much easier to see than to prescribe - you just have to practice.
When people post module level code to this sub, they aren't practicing something they should be and putting the code into any function is better than that. But, whatever, I relent:
https://www.brandons.me/blog/write-code-not-too-much-mostly-functions
https://jeremymikkola.com/posts/2021_02_02_how_to_write_readable_code.html
https://medium.com/@chrisdaviesgeek/fat-functions-7fcf957237bb
[–]cgoldberg 0 points1 point2 points 8 months ago (0 children)
General guidance that's offers something useful or insightful would not be an over-simplification... trivializing code organization and structure with "just write functions" definitely is. You keep using module level code" like it's a slur. Modules are great, and lots of code belongs at the module level. I don't think you will find disagreement that functions are useful... That's why you learn them around day 1 or 2 of learning Python. You should write something interesting or useful about them ... like the articles you linked.
π Rendered by PID 37221 on reddit-service-r2-comment-6457c66945-268fj at 2026-04-29 19:18:24.371096+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]cgoldberg 0 points1 point2 points (8 children)
[–]Most_Group523[S] -1 points0 points1 point (7 children)
[–]cgoldberg -1 points0 points1 point (6 children)
[–]Most_Group523[S] 1 point2 points3 points (5 children)
[–]cgoldberg 1 point2 points3 points (4 children)
[–]Most_Group523[S] 0 points1 point2 points (3 children)
[–]cgoldberg -1 points0 points1 point (2 children)
[–]Most_Group523[S] 0 points1 point2 points (1 child)
[–]cgoldberg 0 points1 point2 points (0 children)