DEV Community

Discussion on: Ways to count occurrences of the list items in Python

Collapse
 
jingxue profile image
Jing Xue • Edited

The for ... in ... loop is not necessarily the fastest, or at least not anymore. According to this benchmark Counter was the slowest in python2, but was optimized in python3 to be significantly faster.

Collapse
 
kedark profile image
Kedar Kodgire

Ohh, didn't knew this before. Thanks for sharing..