The logic module contains the Expression class, which wraps up the lambdas and adds some sugar, like simpler filters, and allowing you to add (logical-and) Expressions together:

>>> f = logic.Expression(lambda x: x.Size > 3)\n>>> g = logic.filter(Color='Blue')\n>>> f += g\n>>> f\nlogic.Expression(lambda x: (x.Size > 3) and (x.Color == 'Blue'))


The codewalk module does the bytecode inspection, etc.

Both at [link|http://www.aminus.org/rbre/python/index.html|http://www.aminus.or...python/index.html]