Go to Google Groups Home    comp.lang.python
Re: 0 == False but [] != False?

Dan Bishop <danb...@yahoo.com>

On May 24, 1:59 am, Tim Roberts <t...@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.