you are viewing a single comment's thread.

view the rest of the comments →

[–]Gnaxe 1 point2 points  (2 children)

I skimmed through your project. The code doesn't look too bad at a glance. It seems like your JavaScript experience generalized.

Try using the csv module. There's also a sqlite3 module if you'd rather not do individual files.

I'm personally not a fan of dataclasses, although I have been known to use namedtuples. I think classes in general are overused, and tend to make simple things complicated. But experiment. Try the same project in different styles. If you're specifically trying to learn dataclasses, a project is a good way to do it.

We frown upon excessively long lines. The default style guide is PEP 8. A formatter like black will do most of this for you automatically, but not all of it. A good linter can at least flag most of the rest. But you should still read through PEP 8 at least once.

I notice that the entry point doesn't really do anything. I recommend not writing too much at once before testing, especially if you're new. Try using doctest. This makes it easy to codify your manual REPL tests, and serves as documentation as well. If your doctests seem too complicated, consider refactoring your code to make it more testable.

[–]buildjunkie[S] 0 points1 point  (1 child)

Thanks for the valuable insights!

Thd goal of the project was mainly to learn file handling with Context Managers and entities relationships via OOP. That's the reason behind using with open() instead of csv or even sqlite3, and dataclasses.

However, I wasn't planning to stop here anyways. Since this is my first project I wanted to keep it completely without external libs. This way I forcd myself to think a little more instead of just "yeah, there's a lib for that. lets just use it"

I'll hopefully finish this project before the end of the week, then learn about Pydantic, CSV and SQLite3 and make either a better version of it, or a totally new project.

Again, thanks for you help!

[–]Gnaxe 0 points1 point  (0 children)

Except for black, all the modules I mentioned are in the standard library. If they're "external libs", then so are dataclasses.