machine-learning-articles icon indicating copy to clipboard operation
machine-learning-articles copied to clipboard

Advanced Python: 9 Best Practices to Apply When You Define Classes

Open khuyentran1401 opened this issue 4 years ago • 0 comments

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

khuyentran1401 avatar Aug 15 '20 13:08 khuyentran1401