Making the case for "typed" lists/iterators in python
Roy Smith
roy at panix.com
Fri Dec 16 13:05:37 EST 2011
In article <mailman.3739.1324057724.27778.python-list at python.org>,
Nathan Rice <nathan.alexander.rice at gmail.com> wrote:
> I'd like to hear people's thoughts on the subject. Currently we are
> throwing away useful information in many cases that could be used for
> code analysis, optimization and simpler interfaces.
Most of this was TL:DNR, but I will admit I often wish for a better way
to log intermediate values. For example, a common pattern in the code
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.
More information about the Python-list
mailing list