dict() vs {}

Python

Python provides two different ways to create a dictionary: dict() and {}. I prefer dict() when creating empty dictionaries to improve readability.

 

In this post, I want to check the performance across different usages and not only initialization.

> more
performance of all() and any()

Python

The built-in functions all() and any() are nice and if the comparison is small, they are easy understandable. But how do they perform? Should we use them at all if our code needs to be fast?

 

Let me share my findings when I did some performance tests.

> more