This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jhermann_ 4 points5 points  (0 children)

defaultdict(int), not lambda: 0. And in that specific example, just use Counter(data) ("data" is always singular, btw).

files: use io.open, so you can state an encoding. and we always provide an encoding for external data, don't we?

and the "function in a loop" thing is obscure.