__Post_init__: Add Attributes To A Dataclass Object Post Initialization
After initializing a class object, we often create derived attributes from existing variables.
To do this in dataclasses, you can use the __𝐩𝐨𝐬𝐭_𝐢𝐧𝐢𝐭__ method. As the name suggests, this method is invoked right after the __𝐢𝐧𝐢𝐭__ method.
This is useful if you need to perform additional setups on your dataclass instance.
Share this post on LinkedIn: Link.
Find the code for my tips here: GitHub.
I like to explore, experiment and write about data science concepts and tools. You can read my articles on Medium. Also, you can connect with me on LinkedIn.