Learn Before
Class Variable vs Instance Variable
Class variables are attributes that are common for all its instances and declared in the class definition. But Instance variables are unique to a particular instance and are declared inside the ___init___() method.
For example, if we have a Class called Employee, each employee (an instance) will have unique employee_id, but might have the same manager_id. So in this case, manager_id should be declared as class variable and employee_id should be instance variable.
0
2
Tags
Python Programming Language
Data Science
Related
Defining Classes in Python
Class Variable vs Instance Variable
Class Inheritance
"Self" Keyword in Python Class
init() method in Python
Methods vs. Functions
Encapsulation in Python
Class Composition
Math Constants
Math Constants
Useful Math Constants in Python
The add_to_class Utility Function
The HyperParameters Utility Class
The ProgressBoard Utility Class
Base Module Class in Deep Learning Implementation