Whoa - you can put a class definition inside a function definition?
def foo(x):
yield len(x)
yield len(x)
>>> g = foo(range(5))
>>> g.next()
5
>>> len = lambda y: 8
>>> g.next()
8
This causes problems when trying to implement an efficient python. You have to re-lookup your function bindings every time.[1]: Example taken from Colin's Unladen Swallow presentation http://llvm.org/devmtg/2009-10/Winter_UnladenSwallowLLVM.pdf
There is also pycsp: http://code.google.com/p/pycsp/