Easy function, please help.

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Feb 10 21:08:37 EST 2011


On Thu, 10 Feb 2011 12:01:57 -0500, Terry Reedy wrote:

> On 2/10/2011 11:52 AM, Ethan Furman wrote:
>> Jason Swails wrote:
> 
> 
>>> How is "while n != 0:" any worse?
> 
> 1. It is redundant, just like 'if bool_value is not False:'. Python
> programmers should understand the null value idiom.

I find that if statement too implicit for my tastes. I prefer to be 
explicit about the values returned by comparisons, rather than just 
assume that the reader understands Python's comparisons. Unfortunately, I 
never know when to stop.

if bool_value is not False is True is True is True is True is ... 


-- 
Steven



More information about the Python-list mailing list