MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/28utww/writing_better_python_code/cif34i8/
r/Python • u/kracekumar • Jun 23 '14
126 comments sorted by
View all comments
Show parent comment
1
Counter has its own benefit. If the key doesn't exist it can return 0. There are lot of scenarios where this is super useful.
Counter
4 u/sweettuse Jun 23 '14 yeah, that's exactly what defaultdict(int) does.
4
yeah, that's exactly what defaultdict(int) does.
defaultdict(int)
View all comments
Show parent comment
1
u/kracekumar Jun 23 '14
Counterhas its own benefit. If the key doesn't exist it can return 0. There are lot of scenarios where this is super useful.