Classes
摘要
As I already mentioned, you should only store objects with the same properties in lists, even though you can store anything you want there in Python. However, the code becomes unreadable if you do this. To store different properties of an object, you should define a class. To do this, we start with data classes, which are intended to store data and no methods. Though you can do pretty much everything you want in Python, you can also create data classes containing methods (functions inside a class).