def object_type_repr ( obj ) : if obj is None : return 'None' elif obj is Ellipsis : return 'Ellipsis' if obj . __class__ . __module__ == '__builtin__' : name = obj . __class__ . __name__ else : name = obj . __class__ . __module__ + '.' + obj . __class__ . __name__ return '%s object' % name
how to print the object type in python
Returns the name of the object s type . For some recognized singletons the name of the object is returned instead . ( For example for None and Ellipsis ) .
def object_type_repr(obj):
    """Returns the name of the object's type.  For some recognized
    singletons the name of the object is returned instead. (For
    example for `None` and `Ellipsis`).
    """
    if obj is None:
        return 'None'
    elif obj is Ellipsis:
        return 'Ellipsis'
    if obj.__class__.__module__ == '__builtin__':
        name = obj.__class__.__name__
    else:
        name = obj.__class__.__module__ + '.' + obj.__class__.__name__
    return '%s object' % name