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 Strings
Python Program to Convert Decimal to Binary Using Recursion
Python Input, Output and Import
Python Tuple count()
Python Program to Iterate Over Dictionaries Using for Loop
Learning scikit-learn Machine Learning in Python - Raul Garreta & Guillermo Moncecchi
Python Machine Learning - Sebastian Raschka
Python hash()
Introduction to Machine Learning with Python - Andreas C.Muller & Sarah Guido
Python Program to Illustrate Different Set Operations
Python Operator Overloading
Python Set clear()
Python Get Current time
Python setattr()
Python Program to Make a Flattened List from Nested List
Python String isupper()
Python len()
Python __import__()
Python String rindex()
Intelligent Projects Using Python - Santanu Pattanayak
Python Program to Represent enum
Python Program to Make a Simple Calculator
Python bytearray()
Deep Learning with Python - A Hands-on Introduction - Nikhil Ketkar
Python Program to Concatenate Two Lists
Python pass statement
Python Program to Shuffle Deck of Cards
Python String isspace()
Python bool()
Python Program to Display Calendar
Python Program to Add Two Matrices
Python strptime()