November 15
Up one levelMaterials from the November 15 class
-
assigment_due_2006_11_29.py
- Homework assignment due November 29
-
A Warning to PythonWin users
- If you are using PythonWin to do this homework, you will get stuck on your first error. This page explains what to do about it.
-
Monkey Patch
- Wikipedia article describing the Monkey Patch -- a technique for patching the behavior of a library at runtime without touching the source code for the library.
-
Python Cookbook
- This website is a collection of recipes of Python code for many different things. If you are looking for a metaclass, decorator, or descriptor to do something fancy, then this is the place to go.
-
Lazy Attributes
- An example recipe. Here a custom descriptor and metaclass allow you to define a class with attributes that will only be computed when needed. When the value is finally computed, it is stored in the object.
-
Cache Decorator
- Another sample recipe. This decorator can be applied to any callable. It will cache the results of the computation, so that if the callable is invoked again with the same parameters the result will be fetched from the cache.