w3resource

Python: object() function

object() function

The object() function is used to create an empty object.

Object is a base for all classes. It has the methods that are common to all instances of Python classes.

Version:

(Python 3.2.5)

Syntax:

object

Parameter:

This function does not accept any arguments.

Return value:

A new featureless object.

Example: Python object() function

Example = object()

print(type(Example))
print(dir(Example))

Output:

<class 'object'>
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']

Python Code Editor:

Previous: next()
Next: oct()

Test your Python skills with w3resource's quiz



Python: Tips of the Day

How do I check if a list is empty?

For example, if passed the following:

a = []
if not a:
  print("List is empty")

Ref: https://bit.ly/2A4JXx9