Python 3 reference · Built-in Functions

Python object() Function

Return a new featureless object. object is the base class of every Python class and provides the default methods.

Python 3 Since 3.0

Syntax

object()

Return value

A new, unique object instance.

Examples

Every class inherits from objectTry it yourself
class Point:  # implicitly inherits from object
    pass

print(Point.__mro__)
print(isinstance(42, object))

Output

(<class 'Point'>, <class 'object'>)
True
A unique sentinel value (before Python 3.15)Try it yourself
MISSING = object()  # a unique marker value

def get(d, key, default=MISSING):
    if key in d:
        return d[key]
    if default is MISSING:
        raise KeyError(key)
    return default

print(get({"a": 1}, "b", None))

Output

None

Good to know

Plain object() instances can't have attributes (object().x = 1 fails). In Python 3.15 and later, the sentinel() built-in is a clearer way to create marker values.

Version history

VersionChange
Python 3.0Added