Why is the dict literal syntax preferred over the dict constructor?
Why is the dict literal syntax preferred over the dict constructor? Question: Why is the Python dict constructor slower than the using literal syntax? After hot debate with my colleague, I did some comparison and got the following statistics: python2.7 -m timeit “d = dict(x=1, y=2, z=3)” 1000000 loops, best of 3: 0.47 usec per …
Total answers: 1