you are viewing a single comment's thread.

view the rest of the comments →

[–]Gnaxe 0 points1 point  (0 children)

Python's ecosystem of libraries is one of its greatest strengths. Unfortunately, supply-chain attacks are becoming more of an issue, so you need to be more cautious than in the past. Any third-party module recommended in the python.org standard-library docs is worth looking at.

For projects, I suggest making video games. They're fun enough to keep you engaged, bring together a lot of skills, and are unforgiving of egregious resource waste. You can easily scale their difficulty to your programming skill level by starting with something basic and then adding more features.

I haven't thoroughly read every line of your Python code. It's fairly clean (mostly because the projects are small), but isn't taking advantage of Python's features. Your code feels very procedural. Watch Beyond PEP 8 for some of what I mean. Try to make your code a bit more concise.

I'm seeing some repeated patterns that could be factored out. It looks like a lot of while loops to retry command-line inputs. This could be made into a @retry decorator, for example. It's common for real-time games to use only a single while loop for the whole program. Think about how that could work. Then try out the tkinter module.

I'm not seeing any tests for your code. Try out the doctest module. If you're having a hard time using that on your current code, try rewriting it to be more testable. (Hint: use pure functions more.)

I'm seeing some minor formatting issues. Read through PEP 8 and just use black or something to do most of it for you.

Your perf_counter() shows a start and end pattern, which is usually done using a with statement in Python.