To get a string representation of a class name we can use obj.__class__.__name__ is it possible to overload these methods so that I can return my string instead of the actual class name?
To get a string representation of a class name we can use obj.__class__.__name__ is
Share
Let’s try! (Yes, this works):
You could also have just done
Foo.__name__ = 'Bar', I usedobj.__class__.__name__to be consistent with your question.