Making the case for "typed" lists/iterators in python
Ben Finney
ben+python at benfinney.id.au
Fri Dec 16 15:17:15 EST 2011
Roy Smith <roy at panix.com> writes:
> 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.
What's wrong with that though?
You're not “pulling it out to” anything; you're binding a name to the
value in order to do several things with it. Exactly what you say you
want to do. It's explicit and clear.
--
\ “What we usually pray to God is not that His will be done, but |
`\ that He approve ours.” —Helga Bergold Gross |
_o__) |
Ben Finney
More information about the Python-list
mailing list