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:
Machine Learning with Python for everyone - Mark E.Fenner
Python bytearray()
Python String isdigit()
Python Set symmetric_difference_update()
Learning scikit-learn Machine Learning in Python - Raul Garreta & Guillermo Moncecchi
Python time Module
Deep Learning with Python - Francois Cholletf
Python String isalpha()
Python Program to Display Fibonacci Sequence Using Recursion
Python Program to Merge Mails
Python Program to Get the Last Element of the List
Python Machine Learning - Sebastian Raschka
Python List reverse()
Python Program to Concatenate Two Lists
Python Program to Get Line Count of a File
Python Program to Count the Occurrence of an Item in a List
Python String rstrip()
Python Functions
Python Program to Remove Duplicate Element From a List
Python Program to Compute all the Permutation of the String
Python List index()
Python Machine Learning Cookbook - Practical solutions from preprocessing to Deep Learning - Chris A...
Python float()
Python Deep Learning - Valentino Zocca & Gianmario Spacagna & Daniel Slater & Peter Roelants
Python Program to Get File Creation and Modification Date
Python Program to Slice Lists
Python Program to Find the Factorial of a Number
Python sorted()
Python Operator Overloading
Python memoryview()
Python String isdecimal()
Python Program to Find ASCII Value of Character