Python object() Function
Description
object() function returns an empty object. We cannot add new attributes or methods to this object.
object() The object returned by the function is the base class of all classes. It has no attributes or methods of its own, only some special attributes and methods common to all Python built-in objects, such as doc 、class、delattr、getattribute , etc.
object() is the most fundamental object in Python. All other objects are derived from it. Therefore, the object() object is the topmost superclass (also called base class or parent class) of all Python classes. All built-in types, user-defined classes, and any other types inherit from it directly or indirectly.
Syntax
id syntax:
object()
Parameter Description:
- none.
Return Value
returns an empty object.
Example
The following example creates an empty object:
x
=
object
(
)
(
dir
(
x
)
)
The output of the above example is:
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
Python built-in function