The same information stored in __class__
could be retrieved by calling a type()
function with one argument:
for element in (1, 'a', True):
print(element, 'is', element.__class__, type(element))
The results are:
1 is <class 'int'> <class 'int'>
a is <class 'str'> <class 'str'>
True is <class 'bool'> <class 'bool'>
output