if, continuation and indentation

Aahz aahz at pythoncraft.com
Fri Jun 4 17:25:48 EDT 2010


In article <mailman.663.1274969462.32709.python-list at python.org>,
Tim Chase  <python.list at tim.thechases.com> wrote:
>
>While it's not PEP material, I tend to use the coding standards I 
>learned working for Computer Sciences Corporation (10 yrs ago, so 
>things may have changed) that mandated 2 levels of indentation 
>for continued lines, turning the above into
>
>   if (width == 0 and
>           height == 0 and
>           color == 'red' and
>           emphasis == 'strong' or
>           highlight>  100):
>           # or the closing "):" on this line,
>           # aligned with the previous line
>       raise ValueError("sorry, you lose")

+1
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you don't know what your program is supposed to do, you'd better not
start writing it."  --Dijkstra



More information about the Python-list mailing list