Message from discussion
0 == False but [] != False?
Path: g2news1.google.com!postnews.google.com!q66g2000hsg.googlegroups.com!not-for-mail
From: Dan Bishop <danb...@yahoo.com>
Newsgroups: comp.lang.python
Subject: Re: 0 == False but [] != False?
Date: 24 May 2007 16:02:20 -0700
Organization: http://groups.google.com
Lines: 13
Message-ID: <1180047740.001604.267170@q66g2000hsg.googlegroups.com>
References: <1179982400.412340.178710@g4g2000hsf.googlegroups.com>
<1rda53hphn117k5scvcqrc7c2e37utfhgu@4ax.com>
NNTP-Posting-Host: 72.177.181.97
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Trace: posting.google.com 1180047740 17832 127.0.0.1 (24 May 2007 23:02:20 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 24 May 2007 23:02:20 +0000 (UTC)
In-Reply-To: <1rda53hphn117k5scvcqrc7c2e37utfhgu@4ax.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: q66g2000hsg.googlegroups.com; posting-host=72.177.181.97;
posting-account=U2kTDQwAAACh4bipJkJPrjlruWGdlLaM
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.