re: How to Merge Two Dictionaries in Python VIEW POST


Great article. I liked the many options to solve the problem. I feel the dictionary comorehension is too much of a cool trick that is hard to understand. The scaling version with the kwargs is beautiful.

Like some other articles, I'm a bit disappointed with using time libraries to measure performance of code because the running time is biased and tied up to the machine performance. Big O notation would be more suitable.


Big O is great, but you'd need to know how these solutions work internally to measure it. That's why we use empirical measurements like the timeit library to get a rough idea of each solution's performance.

Personally, I prefer correctness and readability over performance anyway. If something becomes a major bottleneck, then I would start looking into more performant solutions.

Code of Conduct Report abuse