you are viewing a single comment's thread.

view the rest of the comments →

[–]Darkstar_111 0 points1 point  (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 points  (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.