PEP 308: A PEP Writer's Experience - CON

Carlos Ribeiro cribeiro at mail.inet.com.br
Sun Feb 9 13:32:44 EST 2003


On Sunday 09 February 2003 00:03, Andrew Dalke wrote:
> And the relatively minor one
> [6] Is harder to debug, because you'll need to break out the
> different terms before you can add print statements to them

The problem that you point out is real in the general case, but I don't agree 
with this argument for this particular context. On the positive side, 
conditional expressions are useful when printing data for debugging purposes 
(to select which data to print, for example). As for the negative side - can 
you add print statements (I mean, easily!) to listcomps or lambdas?

While talking about lambdas, even old-style Python constructs such as map(), 
filter(), and reduce() may be hard to debug. I've had a nasty bug with a 
simple reduce() a few weeks ago - a weird combination of data broke my lambda 
function - and it was a nightmare to detect it, as it didn't raise an 
exception, but just caused the wrong result to be returned.


Carlos Ribeiro
cribeiro at mail.inet.com.br






More information about the Python-list mailing list