For review: PEP 308 - If-then-else expression

Carlos Ribeiro cribeiro at mail.inet.com.br
Sun Feb 9 08:47:19 EST 2003


On Saturday 08 February 2003 20:15, Paul Moore wrote:
> Oddly, the only argument I find even remotely compelling is the lines
> of code one (which most people would say is the weakest). Less lines
> of code means more code visible at one time, which means you have a
> better overall view of the control flow of a function. But I've never
> seen Python code with functions long enough for that to matter in
> practice.

Code for business-related stuff tend to be much longer than 'pure' programming 
(I hope you'll understand what I mean). Stuff such as data validation, 
filtering and reporting tend to generate very long blocks of code; in some 
cases, the amount of small choices that you have to handle is enough to make 
the function grow to the point where the structure becomes confusing.

> Maybe it all boils down to how finely you decompose things. The more
> you do, the less benefit there is to a conditional expression.

Decomposing things is fine in many cases, but for stuff that is rarely reused, 
such as filtering conditions, it just makes things worse.


Carlos Ribeiro
cribeiro at mail.inet.com.br





More information about the Python-list mailing list