The object() function returns a featureless object which is a base for all classes.
The syntax of object()
is:
o = object()
1. object() Parameters
The object()
function doesn’t accept any parameters.
2. Return Value from object()
The object()
function returns a featureless object.
3. Example: How object() works?
test = object() print(type(test)) print(dir(test))
Output
<class 'object'> ['__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__']
Here, an object test is created.
In the program, we have used type() to get the type of the object.
Similarly, we have used dir() to get all the attributes. These attributes (properties and methods) are common to instances of all Python classes.
Related posts:
Python filter()
Python Closures
Python Set issuperset()
Python Machine Learning - Sebastian Raschka
Python Program to Compute the Power of a Number
Python Program to Make a Simple Calculator
Python Dictionary popitem()
Python Program to Find Factorial of Number Using Recursion
Python Program to Create a Countdown Timer
Python Program to Find Numbers Divisible by Another Number
Python String rsplit()
Python List count()
Python divmod()
Python isinstance()
Building Chatbots with Python Using Natural Language Processing and Machine Learning - Sumit Raj
Python del Statement
Python Program to Trim Whitespace From a String
Python Program to Get Line Count of a File
Python pass statement
Python ord()
Python Program to Find ASCII Value of Character
Python List extend()
Python Program to Randomly Select an Element From the List
Python zip()
Python String istitle()
Python ascii()
Python String isprintable()
Python super()
Python round()
Python Program to Find the Largest Among Three Numbers
Python repr()
Deep Learning with Applications Using Python - Navin Kumar Manaswi