Code formatting question: conditional expression

Jean-Michel Pichavant jeanmichel at sequans.com
Tue Aug 18 11:57:01 EDT 2009


John Posner wrote:
>>
>> My choice would be
>>
>> excessblk = None
>> if total > P.BASE:
>>     excessblk = ...
>>
>
> Diez and Jean-Michel,
>
> Ha! Your suggestion above was my *original* coding. It looks like I'm 
> evolving backwards!
>
> But doesn't it violate the DRY principle? The token "excessblk" 
> appears twice instead of once.
>
> Thanks again,
> John
>
I don't see any problem in that. You are hunting poor readability, not 
redundancy, it's up to you to decide of you priorities. I would still 
advise that readability should rule your world.

JM







More information about the Python-list mailing list