Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'float': 0.07; 'explanation': 0.09; 'keys,': 0.09; 'received:internal': 0.09; '23,': 0.16; 'bitwise': 0.16; 'bool': 0.16; 'false)': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'subclass': 0.16; 'wrote:': 0.18; 'thorough': 0.19; 'thu,': 0.19; 'logical': 0.24; 'mathematical': 0.24; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'array': 0.29; 'division': 0.31; 'int,': 0.31; 'checking': 0.33; 'received:66': 0.35; 'something': 0.35; 'equal': 0.35; 'operations': 0.35; 'everyone.': 0.36; 'false': 0.36; 'thanks': 0.36; 'should': 0.36; 'received:10': 0.37; 'to:addr:python-list': 0.38; 'though,': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'from:no real name:2**0': 0.61; 'simply': 0.61; 'header:Message- Id:1': 0.63; '2014,': 0.84; 'kennedy': 0.84 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:x-sasl-enc:from:to:mime-version :content-transfer-encoding:content-type:subject:date:in-reply-to :references; s=mesmtp; bh=XW2VA237tgNXkroUtB9jwlVW30w=; b=dJrYax l/3wrlloQ5tfit2jBXVVPQ7Bb1yYCGi/34dpGcKX0+Q7AZsgaFZrlXNQ4c/Fb8Cm i/bHMMr6xJdKNjnYDY008vsXd1TGw6Gtevq+ZkbgvwLZMiAdKbqqAyeN4SU8Bqeo KaKA/bSwiW7f1cjqAXm4gYeOfQYMuNVJp4RwY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:x-sasl-enc:from:to :mime-version:content-transfer-encoding:content-type:subject :date:in-reply-to:references; s=smtpout; bh=XW2VA237tgNXkroUtB9j wlVW30w=; b=urJbgccoE4fZl8nrHthfYiAslacG+ncoasyOb4kTp0FOZHawP481 r/ff846/IywC8z80XNk8KTIoTys/daEaVVe1qBzn3RVw/+pIBoNk/R6JUAloguK0 PS+b5SRjn/dg5DFW/kTJ0PjhhPfp5yYNmm3jVp3xnveN5xaxtKGHtvo= X-Sasl-Enc: wz5SBehqmsotbQuB518EKpErOWmO3X8ujkLf7Z8lrprC 1414077883 From: random832@fastmail.us To: python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-c1967a3d Subject: Re: Truthiness Date: Thu, 23 Oct 2014 11:24:43 -0400 In-Reply-To: <074b949d-9999-42b9-9136-6e32d1cee922@googlegroups.com> References: <61f0b04c-b827-4c03-b55d-4d5bd85b56f6@googlegroups.com> <074b949d-9999-42b9-9136-6e32d1cee922@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414077886 news.xs4all.nl 2874 [2001:888:2000:d::a6]:47855 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79535 On Thu, Oct 23, 2014, at 10:56, Simon Kennedy wrote: > Thanks everyone. That's a thorough enough explanation for me. You should know, though, that numeric values equal to 1 (and 0 for False) _are_ == True. This works for dictionary keys, array indexes, etc. The bool type is actually a subclass of int. Mathematical operations on it will simply return an int, or float for division - logical operations and bitwise and/or/xor return bool (bitwise not returns an int because it returns the values -1 and -2) So checking if something is == True is the same as checking if it's == 1, and checking if it's == False is the same as checking if it's == 0.