How to change built-in type() function?
You can use __name__
property
simple_string = "this is a simple string"
type(simple_string).__name__
>>> 'str'
In python, everything is an object.
The type()
function simply returns a reference to the class of which the object is an instance of. Think of the class like the mold and the object as something created from that mold.
The type() function will return a python object reference to the class from which the object is derived. To get the name of the class (in this case 'str'), you can access the name property as follows:
my_class = type('my string')
my_class_name = class.__name__