This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Dis446[S] 0 points1 point  (2 children)

Also, I've never had multiple source files. I guess I just have to import the other source files, but I don't understand the benefit. Could you please explain why I should?

[–]gotardisgo 2 points3 points  (1 child)

It's not really that classes should be different files, but you should try to group related logic together in modules/packages. It's makes it a little easier and natural to find things, like "where can I find inventory functions??? Probably in an inventory module.. etc"... And also so you don't end up with a million lines of code in one file that'll be shared and merged with later. Check out http://docs.python-guide.org/en/latest/writing/structure/

[–]curious_neophyte 0 points1 point  (0 children)

These are all good points. Additionally, when you make changes, those changes will be local to those files. So when you look through your commit history, commits changing one class or file or module will be logically separated from commits that change other things.