Python Objects
Python uses the object model abstraction for data storage. Any construct which contains any type of value is an object. Although Python is classified as an “object-oriented programming language,” OOP is not required to create perfectly working Python applications. You can certainly write a useful Python script without the use of classes and instances. However, Python’s object syntax and architecture certainly encourage or “provoke” this type of behavior. Let us now take a closer look at what a Python “object” is.
All Python objects have the following three characteristics: an identity, a type, and a value.
IDENTITY : Unique identifier that differentiates an object from all others. Any object’s identifier can be obtained using the id() built-in function. This value is as close as you will get to a “memory address” in Python (probably much to the relief of some of you). Even better is that you rarely, if ever, access this value, much less care what it is at all.
TYPE : An object’s type indicates what kind of values an object can hold, what operations can be applied to such objects, and what behavioral rules these objects are subject to. You can use the type() built-in function to reveal the type of a Python object. Since types are also objects in Python (did we mention that Python was object-oriented?), type() actually returns an object to you rather than a simple literal.
VALUE : Data item that is represented by an object.
Python supports a set of basic (built-in) data types, as well as some auxiliary types that may come into play if your application requires them. Most applications generally use the standard types and create and instantiate classes for all specialized data storage.