|
|
|
|
|
by sametmax
2911 days ago
|
|
Don't wait for 3.8, and don't bother with defaultdict. collections.Counter is what you want for the counting case. dict.get() + dict.setdefault() for the general case. defaultdict is only useful if the factory is expensive to call. |
|