class’ and ‘object’ in python is little confusing for people having C++ or JAVA background. In Python everything is an object, for example- integer is a object, float is a object, list, dictionary etc, everything is an object in python.
So in this way a class is also a object (class object) and instance created from a class is also an object (instance object) in python.
From design perspective, you can think class as a template that is placeholder for data and related methods. Object (Instance object) is created/instantiated from the class with real values.
0 comments:
Post a Comment