I was working on a Python program, and somewhere in the code I have to convert some heavy data to a string. But then I ran some tests to see what would be the best approach. I thought of two ways and I made some tests using timeit
:
My question is: why string formatting was faster than calling str()
?