0 == False but [] != False?

Steve Holden steve at holdenweb.com
Thu May 24 19:09:09 EDT 2007


Dan Bishop wrote:
> On May 24, 1:59 am, Tim Roberts <t... at probo.com> wrote:
> ...
>> False is just a constant.  0, (), '', [], and False are all constants that
>> happen to evaluate to a false value in a Boolean context, but they are not
>> all the same.
>>
>> As a general rule, I've found code like "if x == False" to be a bad idea in
>> ANY language.
> 
> I have a job as a C++ programmer, and they make us write it like that,
> apparently because the ! operator is hard to see.  But "if (x ==
> TRUE)" is discouraged.
> 
Find a new employer. I'm not joking.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden
------------------ Asciimercial ---------------------
Get on the web: Blog, lens and tag your way to fame!!
holdenweb.blogspot.com        squidoo.com/pythonology
tagged items:         del.icio.us/steve.holden/python
All these services currently offer free registration!
-------------- Thank You for Reading ----------------




More information about the Python-list mailing list