No video to show.
PyOhio 2010: Building your own kind of dictionary
Building your own kind of dictionary
Presented by W. Matthew Wilson
My talk is based on a project that seemed very simple at first. I wanted an object like the regular python dictionary, but with a few small tweaks:
- values for some keys should be restricted to elements of a set
- values for some keys should be restricted to instances of a type
For example, pretend I want a dictionary called favorites, and I want the value for the "color" key to be any instance of my Color class. Meanwhile, for the "movie" key, I want to make sure that the value belongs to my set of movies.
In the talk, I'll walk through how I used tests to validate my different implementations until I came up with a winner.
Unlike my talk last year on metaclass tomfoolery, and the year before that on fun with decorators (and decorator factories) I'm hoping to make this talk straightforward and friendly to beginning programmers.
- how I use tests to solve a real-world problem
- a few little gotchas with the super keyword
- a little about how python works under the hood.