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 Set issuperset()
Introduction to Machine Learning with Python - Andreas C.Muller & Sarah Guido
Python Machine Learning Third Edition - Sebastian Raschka & Vahid Mirjalili
Python Dictionary pop()
Python Machine Learning Cookbook - Practical solutions from preprocessing to Deep Learning - Chris A...
Python Program to Convert Bytes to a String
Python String split()
Python Program to Display the multiplication Table
Python String format()
Python zip()
Python int()
Python String isalnum()
Python Program to Append to a File
Python String title()
Python Program to Safely Create a Nested Directory
Python Machine Learning - Sebastian Raschka
Python Shallow Copy and Deep Copy
Python Dictionary popitem()
Python Set add()
Python exec()
Python property()
Python Program to Differentiate Between type() and isinstance()
Python staticmethod()
Python Program to Find Armstrong Number in an Interval
Python strftime()
Python Data Analytics with Pandas, NumPy and Matplotlib - Fabio Nelli
Python String rfind()
Python ascii()
Python *args and **kwargs
Python globals()
Python List extend()
Python Artificial Intelligence Project for Beginners - Joshua Eckroth