On Sep 1, 11:04 pm, Paul Rubin wrote: > I still don't understand why you don't like the decorator approach, > which can easily implement the above.
Well, maybe decorators are the answer. If a function needs only one decorator for all the conditions and invariants (pre and post- conditions), and if it can just point to functions defined elsewhere (rather than defining everything inline), then perhaps they make sense. I guess I need to read up more on decorators to see if this is possible. In fact, the ideal would be to have just a single decorator type, say "contract" or "self_test", that takes an argument that points to the relevant functions to use for the function that the decorator applies to. Then the actual self-test functions could be pushed off somewhere else, and the "footprint" on the primary code would be minimal -- http://mail.python.org/mailman/listinfo/python-list