Python object() built-in function

From the Python 3 documentation

Return a new featureless object. object is a base for all classes. It has methods that are common to all instances of Python classes. This function does not accept any arguments.

Introduction

The object() function returns a new, empty, featureless object. This object is the base for all classes in Python. It doesn’t have any special attributes or methods.

While you can create object instances, it’s not something you’ll do often in day-to-day programming. It’s more of a fundamental building block of Python’s object model.

Example

# Create a new object
o = object()

# See its type
print(type(o))  # Output: <class 'object'>

# It has no attributes you can set
# o.name = "test" # This would raise an AttributeError

Subscribe to pythoncheatsheet.org

Join 16,702+ Python developers in a two times a month and bullshit free publication , full of interesting, relevant links.