Making friendly classes
A friendly class accepts sensible arguments, has a nice string representation, and supports equality checks. Table of contents Always make your classes friendly An example friendly class Quick frie...

Source: www.pythonmorsels.com
A friendly class accepts sensible arguments, has a nice string representation, and supports equality checks. Table of contents Always make your classes friendly An example friendly class Quick friendly classes with dataclasses Dataclasses seem confusing? Not all friendliness is the same Extra friendly classes Use dataclasses as a measuring stick Always make your classes friendly So you've decided to make a class. How can you make your class more user-friendly? Friendly classes have these 3 qualities: They accept sensible arguments Instances have a nice string representation Instances can be sensibly compared to one another (Optionally) When it makes sense, they embrace dunder methods to overload functionality An example friendly class Here's a fairly friendly Point … Read the full article: https://www.pythonmorsels.com/friendly-classes/