On 12/16/2011 1:05 PM, Roy Smith wrote:
I'm working with now is functions that end in:return [Foo(x) for x in bunch_of_x_thingies] When something goes amiss and I want to debug the problem, I often transform that into: temp = [Foo(x) for x in bunch_of_x_thingies] logger.debug(temp) return temp It would be convenient to be able to get at and log the intermediate value without having to pull it out to an explicit temporary.
Decorate the function with @logreturn and you do not have to touch the function code. If the logging module does not now have such a decorator predefined (I simply do not know), perhaps it should.
-- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
