资讯

This post explains how to use classes in Python. Including: how to use static and private methods, constructors, and more!
Dataclasses, introduced in Python 3.7 (and backported to Python 3.6), provide a handy, less verbose way to create classes.
Python classes can make your code more complicated than necessary. So when should you use classes, and when should you use standard functions instead?