r/learnpython • • Jul 16 '20

Where to learn about Python program structure/design?

I'm self-taught in Python and am able to write programs that work, but I still don't feel like I know what I'm doing. Where can I learn about program structure/design?

I usually just start coding and one thing leads to another and pretty soon, I'm done. But I can't shake the feeling that a professional programmer would look at my code and laugh at how haphazard and inefficient it is. Any pointers or suggestions? Or are we just supposed to figure it out for ourselves?

375 Upvotes

57 comments sorted by

View all comments

20

u/[deleted] Jul 17 '20

I think a great way to learn is by going through popular libraries on github (pandas, numpy, flask, etc.). Try to find one that is closely related to the project you are working on and compare your structure and try to find some ways to improve it.

15

u/lifebytheminute Jul 17 '20

This confuses me, every time I go on GitHub I get more confused. Projects look too big and information is everywhere and I have no idea how to navigate through it all, nor can I tell how to even use the code on git. It’s all a hot mess to me.

2

u/MCPOON11 Jul 17 '20 edited Jul 17 '20

For serious projects on GitHub there’s a whole load of non code files in the root folder of the repo.

You might see gitignore, Docker files, Docker compose, Tox ini and Travis yml files, setup, readme, change logs, etc, probably a doc/ folder just for setting up documentation.

Usually a good place to start is to try to find the subfolder that has the same name as the project / package, should have the actual code in it.

Taking a look at the tests folder inside that directory also gives you some hints about what the writers have been focusing on and how the project code connects together.

1

u/lifebytheminute Jul 17 '20

Thanks. I think this is an aspect that most tutorials on how to actually use GitHub fall short, explaining the how and why behind all these files.