Fun with Python's Newer Tools -fun with python's newer tools

1 year ago
2

Fun with Python's Newer Tools
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.

Loading comments...