Skip to main content

pretty_name

Returns the name of the object's class or the name of the object itself if it is a type.

def pretty_name(
obj: object
) - > string

Retrieves a human-readable string representation of an object's name, prioritizing the class name or the type name itself.

Parameters

NameTypeDescription
objobjectThe object or class from which to extract the name identifier.

Returns

TypeDescription
stringThe name of the class if the input is an instance, or the name of the type if the input is a class.