Posts tagged field
How to use post-init with dataclasses
- 12 October 2023
By default a class in Python has an __init__
method that is called when the class is instantiated. This method is used to initialize the class attributes. The example below shows this in action and how a variable is set by combining two other variables.