|
|
|
|
|
by zach_garwood
1167 days ago
|
|
I think maybe you're overextrapolating here. Classes are meant to hold state. If you have a bunch of related state, wrapping it up in a class has been a common use of classes even before `dataclass` existed. What the talk is discussing is the creation of classes for wrapping related _functionality_, sans state. The class isn't really necessary at that point, so you should just create a module with functions instead of a class. Even if you do need your related functionality to reference some common state, you still might not need a class, because modules themselves are objects and can hold state. The point of the talk is not to dissuade you from _ever_ using classes, it's to make you think more judiciouly about adding new classes you probably don't need. Python isn't Java, and you dont need everything to be a class. |
|