About 637 letters

About 3 minutes

#repr

Description: Convert to string by calling the object’s __repr__ method. See also ascii.

def repr(obj):
    '''
    Convert to string (calls the object's `__repr__` method)

    :param obj: An object
    :return: The string returned by obj.__repr__
    '''

Example:

class Cat:
    def __repr__(self) -> str:
        return "I am a 喵喵"

cat = Cat()

print(repr(cat))

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

Updated: 6/9/2025

Author: PlanC

Created: 6/9/2025