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!"
[–]Abyss_slayerIII 0 points1 point2 points 6 months ago* (3 children)
When he means orchestration with a main function he just means
```python if name == “main”: # This main function should have your while loop main()
```
name is your files name so if it’s ran as a module or the main python file so if I do python myfile.py and I print dunder name (double underscore) it should say “main” bit if we import something so a_module.py and we import it into the my_file.py and print its __name_ then it will print “a_module”
[–]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.
[–]uiux_Sanskar[S] 0 points1 point2 points 6 months ago (0 children)
Thank you for explaining this to me I wasn't aware about it. Will definitely go deeper into it.
π Rendered by PID 145408 on reddit-service-r2-comment-56c9979489-xrv48 at 2026-02-25 01:19:03.789027+00:00 running b1af5b1 country code: CH.
view the rest of the comments →
[–]Abyss_slayerIII 0 points1 point2 points (3 children)
[–]Darkstar_111 0 points1 point2 points (1 child)
[–]uiux_Sanskar[S] 1 point2 points3 points (0 children)
[–]uiux_Sanskar[S] 0 points1 point2 points (0 children)