For classes where you are essentially using them just to hold related data, you should look into the @dataclass decorator. This will write things like the __init__ , __repr__ and __eq__ for you automatically (the latter using piece-wise comparisons, read the documentation). ``` from dataclasses import dataclass @dataclass class Person(): name: str age: int @dataclass Developer(Person): salary: int ``` This cuts out a lot of boilerplate code
For classes where you are essentially using them just to hold related data, you should look into the @dataclass decorator. This will write things like the __init__ , __repr__ and __eq__ for you automatically (the latter using piece-wise comparisons, read the documentation).
```
from dataclasses import dataclass
@dataclass
class Person():
name: str
age: int
@dataclass Developer(Person):
salary: int
```
This cuts out a lot of boilerplate code
Great suggestion! Thanks Icarus!
Starting to make sense but at this stage I can't see myself using classes yet, just a heads up mate, we always decrease age, never increase
😂