Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion 0 == False but [] != False?

View parsed - Show only message text

Path: g2news1.google.com!postnews.google.com!q66g2000hsg.googlegroups.com!not-for-mail
From: Paul McGuire <pt...@austin.rr.com>
Newsgroups: comp.lang.python
Subject: Re: 0 == False but [] != False?
Date: 23 May 2007 22:11:22 -0700
Organization: http://groups.google.com
Lines: 33
Message-ID: <1179983482.452458.188690@q66g2000hsg.googlegroups.com>
References: <1179982400.412340.178710@g4g2000hsf.googlegroups.com>
NNTP-Posting-Host: 24.28.5.42
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Trace: posting.google.com 1179983482 8011 127.0.0.1 (24 May 2007 05:11:22 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 24 May 2007 05:11:22 +0000 (UTC)
In-Reply-To: <1179982400.412340.178710@g4g2000hsf.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: q66g2000hsg.googlegroups.com; posting-host=24.28.5.42;
   posting-account=IOcVPwwAAADAlm594V6XRVIBLOeQOCev

On May 23, 11:53 pm, Rajarshi <rajarshi.g...@gmail.com> wrote:
> 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

This has *got* to rank up there among the VFAQ's of them all, along
with the mysterious shared default empty list argument.  I think this
particular question has been asked in one form or another at least
twice a week for the past month!

-- Paul


Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google