'Why searching in dict.keys() is faster than dict.values()?
I was wondering why the speed of dict.keys() is much higher than dict.values() if there is a dictionary with millions of keys and values?
I was handling a file with millions of entries and searching in dict.values() was taking a huge amount of time compared to dict.keys().
Meaning:
if x not in dict.keys():
vs.
if x not in dict.values():
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
