Should I create each class in its own .py file?

前端 未结 6 1397
故里飘歌
故里飘歌 2020-12-18 18:01

I\'m quite new to Python in general.

I\'m aware that I can create multiple classes in the same .py file, but I\'m wondering if I should create each class in its own

6条回答
  •  感情败类
    2020-12-18 18:12

    No. Typical Python style is to put related classes in the same module. It may be that a class ends up in a module of its own (especially if it's a large class), but it should not be a goal in its own right. And when you do, please do not name the module after the class -- you'll just end up confusing yourself and others about which is which.

提交回复
热议问题