Message from discussion
0 == False but [] != False?
Path: g2news1.google.com!postnews.google.com!g4g2000hsf.googlegroups.com!not-for-mail
From: Rajarshi <rajarshi.g...@gmail.com>
Newsgroups: comp.lang.python
Subject: 0 == False but [] != False?
Date: 23 May 2007 21:53:20 -0700
Organization: http://groups.google.com
Lines: 22
Message-ID: <1179982400.412340.178710@g4g2000hsf.googlegroups.com>
NNTP-Posting-Host: 74.129.230.4
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1179982404 15950 127.0.0.1 (24 May 2007 04:53:24 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 24 May 2007 04:53:24 +0000 (UTC)
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: g4g2000hsf.googlegroups.com; posting-host=74.129.230.4;
posting-account=lX37PA0AAAD2jgTWruoDCacPxlI_gTtK
This is a slightly naive question, but I know that 0 can be used to
represent False. So
>>> 0 == False
True
But, I know I can use [] to represent False as in
>>> if not []: print 'empty'
...
empty
But then doing the following gives a surprising (to me!) result
>>> [] == False
False
Could anybody point out why this is the case?
Thanks,
Rajarshi