The collections module, since Python 2.4, includes a Counter type. I wondered, when I first saw this class, how useful could a counter possibly be? It turns out, very useful. You can do a lot with counters because of their flexibility in terms of what they can count. For instance, you can pass a counter a list of strings, a dictionary who's values represent counts, or strings, where each unique character is counted.
Showing posts with label coroutine. Show all posts
Showing posts with label coroutine. Show all posts
Friday, August 10, 2012
Subscribe to:
Posts
(
Atom
)