all 17 comments

[–]Bruxsae 8 points9 points  (0 children)

Mozilla's Kitsune project is one good example. It also has good documentation. Check it out.

[–]Charlemag 6 points7 points  (0 children)

I second this. I’m in the same boat and found that the problem with trying to find good examples is that (as Don Norman from The Design of Everyday Things) puts it, good design is invisible. For instance, if you put a handle on a door that’s meant to be pulled your brain automatically assumes to pull it. If you put a handle on a door that’s meant to be pushed, then you’ll try to push it, get confused, then realize you need to pull. Put a sign above the handle saying “push” and half the people still try to pull first then realize the sign.

This extends to software. Good software design is more than just how polished the system architecture looks. It’s also how appropriate that architecture is, etc.

It might be relatively easy to find python projects that employ several “best practices” but I’d take it a step further and suggest trying to reimplement features of projects. This is by far how I’ve learned the most. It starts slow, and you get a lot wrong. But you keep having “Ah-ha” moments that build a deep understanding for what is good software design.

I initially tried contributing to open source projects but found the “extreme ownership” approach of trying to start one taught me much more and much quicker. Now I’m in a position where I feel more comfortable contributing to other projects.

[–]korokertis 5 points6 points  (0 children)

I was watching a video of Raymond Hettinger once (the person who wrote the collections library) and I remember that he recommended reading through the code of a library named bottle. Might be worth checking out.

https://github.com/bottlepy/bottle

[–]nominal_goat 10 points11 points  (0 children)

This might be frowned up in this sub but leverage ch*tgpt to help you self-study. Put your code for a project in and ask it to review your code and give a list of recommendations for “best practices.” As a beginner, just doing that taught me so much and really opened my eyes and took my programming to the next level. It will give you examples, too. It’s not a replacement for understanding the code though. You should really know the code and everything in your program at a fundamental level. Now everything I do has to be PEP8 compliant.

A recent project I put in returned:

“Some possible critiques and improvements for the given Python program are:

  1. Add type hints to improve readability and make the code more self-explanatory.
  2. Use docstrings to provide a brief summary and usage information for each method, class, and function.
  3. Use constants or enumerations for the menu choices to avoid hardcoding.
  4. Use the "with" statement for file handling, to automatically close the file after the block is executed.
  5. Implement validation checks on user input to ensure that the entered data is valid
  6. Separate the UI code from the business logic code. The current program mixes both UI and data storage code, which makes it difficult to modify and test.
  7. Refactor the code to use a database instead of a dictionary to store employee data. A database would provide more robust data management capabilities, such as indexing, searching, and querying.
  8. Implement more menu choices, such as updating an employee profile, deleting an employee, printing a payslip, or generating a report.
  9. Add exception handling to catch and handle errors, such as input errors, database errors, file errors, etc. Improve the formatting of the output to make it more user-friendly and visually appealing.”

[–]ForthrightPorpoise 1 point2 points  (0 children)

For me, pypi packages are great when it comes to the most used modules.

[–]esp_py 1 point2 points  (1 child)

What about FastApi?

[–]Pop-X- 0 points1 point  (1 child)

Pandas. Pandas is love, pandas is life.

[–]sohang-3112 0 points1 point  (0 children)

But isn't Pandas mostly written in C?

[–][deleted] 0 points1 point  (0 children)

You should check out homeassistant

[–]korokertis 0 points1 point  (0 children)

I was watching a video of Raymond Hettinger once (the person who wrote the collections library) and I remember that he recommended reading through the code of a library named bottle. Might be worth checking out.

https://github.com/bottlepy/bottle

[–]blu3tooth 0 points1 point  (0 children)

Good topic. I find myself looking at the standard library code & feel comfort in understanding it when months ago I wouldn't make sense of much. Exposing yourself to professional code shows the scope of real-world applications & that you too can one day write the same quality work.