If you want to fix the attributes a class can hold, consider defining it as a slotted class.
While defining classes, __𝘀𝗹𝗼𝘁𝘀__ allows you to explicitly specify the class attributes. This means you cannot randomly add new attributes to a slotted class object. This offers many advantages.
For instance, slotted classes are memory efficient and they provide faster access to class attributes. What's more, it also helps you avoid common typos. This, at times, can be a costly mistake that can go unnoticed.
Read more: StackOverflow.
Share this post on LinkedIn: Post Link.
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.
Just wanted to say thank you for putting these daily doses out. They are really fantastic, and I look forward to reading them! They are really helpful!