pycon logo

PyCon 2011 Atlanta

March 9th–17th

Log in or Sign Up

Fun with Python's Newer Tools

log in to bookmark this presentaton

Novice / Talk
March 13th 11:55 a.m. – 12:25 p.m.
Spend ten minutes each learning to work with Counters, named tuples, new string formatting, and the LRU cache. Learn the basic API, see how it works under the hood, enjoy a simple example, and then have fun pushing it to the limit in interesting ways.


Look at how a Counter is implemented. See a simple word count example. Use a counter for unittests. Implement a sparse matrix.

Show how named tuples are created, combined, subclassed, and extended. See how to implement an Enum class and how to create default values.

Learn the basics of the new string formatting syntax. See how to use it for templating.

Show everyday uses for an LRU cache, look at the underlying implementation, and see how to use it to trivially solve a dynamic programming problem.