Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion 0 == False but [] != False?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rajarshi  
View profile  
 More options May 24 2007, 2:53 pm
Newsgroups: comp.lang.python
From: Rajarshi <rajarshi.g...@gmail.com>
Date: 23 May 2007 21:53:20 -0700
Local: Thurs, May 24 2007 2:53 pm
Subject: 0 == False but [] != False?
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

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