3 ms·
Note, I'm not the one that noticed this, I just tried the difference between literal construction "{}" and using dict(). Good points on the overall (likely) im
by e12e 13y ago
Note, I'm not the one that noticed this, I just tried the difference between literal construction "{}" and using dict().
Good points on the overall (likely) impact on the benchmark(s).
> We prefer idiomatic code and, assuming dict() is idiomatic for such a case, this would be a good change.
I think you mix up two things here: dict() is slower (presumably method look up and maybe class instantiation? Just guessing here) -- and I'd say using the literal notation is in general more idiomatic:
http://docs.python.org/2/tutorial/datastructures.html#dictionaries http://docs.python.org/2/tutorial/datastructures.html#dictio...
- rallison 13y agoOops, yes. I did mix up dict vs the literal version in the comparison. Thank you for the correction. And yes, I noticed that you weren't the one that noticed the original possible performance issue. What I do appreciate is that you actually went and tested the performance difference.