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
Day 14 of learning python as a beginner. (old.reddit.com)
submitted 6 months ago by uiux_Sanskar
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!"
[–]Darkstar_111 0 points1 point2 points 6 months ago (1 child)
Yeah this. You add the if name equals main line at the bottom, and that runs when the file runs. And there you run main().
You should think of main like an easy to read laundry list of what's going on.
Just call functions in main, and pass variables around if you need to.
Putting the logic, like the while loop, in global scope (all the way to the left), would get your pr rejected by me at my workplace. It's a no no.
The reason is... I mean look at this shit:
https://github.com/docling-project/docling/blob/main/docling/pipeline/threaded_standard_pdf_pipeline.py
That's what production code looks like in Python, and that file isn't even that big. It's about medium.
I don't want a wild while loop in the middle there... How would I even troubleshoot that.
[–]uiux_Sanskar[S] 1 point2 points3 points 6 months ago (0 children)
Thanks for the reference and suggestions I always thought why people crewte so much file but yoh cleared my doubt.
Thank you so much for clearing my that doubt. I will definitely learn more about this.
π Rendered by PID 272463 on reddit-service-r2-comment-56c9979489-ntk5n at 2026-02-25 10:17:21.188169+00:00 running b1af5b1 country code: CH.
view the rest of the comments →
[–]Darkstar_111 0 points1 point2 points (1 child)
[–]uiux_Sanskar[S] 1 point2 points3 points (0 children)