Well, the string that gets passed is more or less a function definition, which is then called with exec. I don't see why you'd need to write a string out with the function definition and then call it. You could just write the function.
As for the nested functions, I had been presuming that it was intended to use as a better function than lambda within a function. Sorry for the confusion. -- http://mail.python.org/mailman/listinfo/python-list