machine-learning-articles
machine-learning-articles copied to clipboard
Advanced Python: 9 Best Practices to Apply When You Define Classes
TL;DR
Useful practices to define a class
Article Link
https://medium.com/better-programming/advanced-python-9-best-practices-to-apply-when-you-define-classes-871a27af658b
Key Takeaways
- Give good names to functions and variables
- Class and static methods are really helpful with methods that do not interact much with attributes inside the class
- Use private attributes when you don't want to show methods that users don't use
- Use subclass within a class
- Code alone should show the purpose of the code