Ask HN: Is "Stop Writing Classes” still good advice in modern Python?
One of the main takes is "Don't write classes that could just be a function" (stated in the video as "If a class has two methods and one of them is __init__, it doesn't need to be a class"). But given the addition of dataclasses and typing to python in the last 10 years, is this still good advice for code style?
For a more specific example, I'd prefer to defining a "useless" class for the purpose of typing like this:
@dataclass
class FooFuncParams:
bar: str
baz: int
...
def foofunc(params: FooFuncParams):
...
Rather than having to use overly-permissive typing like this: def foofunc(params: Dict[str, Any]):
...