Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Break and Continue: While Loops Date: Thu, 23 Jun 2016 21:39:25 +1000 Lines: 14 Message-ID: References: <639b00e0-7b9d-4ed4-96ad-6afbcd536786@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 0fSowk5l0pFjIQKEHWj3NASDYc5GtDfzFjGsmm0XZvfg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'true,': 0.04; 'false,': 0.07; 'false.': 0.07; 'cc:addr:python-list': 0.09; 'object)': 0.09; 'python': 0.10; 'thu,': 0.15; '"none"': 0.16; '2016': 0.16; '23,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:74.125.82.46': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'set,': 0.16; 'simple.': 0.16; 'wrote:': 0.16; 'string': 0.17; 'string,': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'interpret': 0.22; 'represents': 0.23; 'header:In-Reply-To:1': 0.24; 'used,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'rules': 0.31; 'true.': 0.33; 'list': 0.34; 'received:google.com': 0.35; 'something': 0.35; 'received:74.125.82': 0.35; 'but': 0.36; 'list,': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'anything': 0.38; 'some': 0.40; 'special': 0.73; 'chrisa': 0.84; 'etc,': 0.84; 'to:none': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=bDe1mv/o8Dwi1A9oMszXR+XSaKBaIWi92cv3PTZy9do=; b=a1MhyN9fOkhIavUenZnJDK21CYRtzvJy/w9vIV7asIuMLmBaTOaiqNRI7118Y9QRZs baTSKEmge5ebzgyB4kH8jdBBMfx8ItmjAkekwWYnlhrqvM98Cee4LUujvfI1KSzY6Rii X7biCFf2uW1f5bxXTzd/hJGdbSIdvaVsKFnaxMfbCd0JmK9JHImY4O+vPUsmKaPCfSeg nVZPaeax0ah7kwqjxAvZFgOziWjw2lpgugCUt/NOROm1kv6vQiI1CxiZ8V6//w1hBj5V anW36yFNiay3QF96QlcEdFjwq8CujZBkeZagerCr2NX+4HOVeVG55Q2uz1O2/qxb6IxW 5bhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=bDe1mv/o8Dwi1A9oMszXR+XSaKBaIWi92cv3PTZy9do=; b=BZy1xi7tUuEKxloRwEyUtlbi7/+H14Y/UrXIQpMJ90Mim9p3XE0bezfLjFA7jXBgwG fuVZ15woMUR8PmB6aI176O+3NoGrVE1Z7Gbk8VOvuUSHIXMrmM6Jq8M7emCaFvXVQFef eURVh1sLfttyFLAoA0H0V5FHmSAm3xtjimaiQ5w3qv2KWldgVP1fuAMtqOnPrhA0QChr E+Tv4LlKa+R74t2ro0CKET9EB2cHQZwG/ZMt0Mq6yk/Id+jP5KyeD+vOHo9X0aIBqi3t oswejhUw5KM4nInLPfmuYYyD+JsDAtEsItqDOpCGLRt0CaBR8o4bp6CrjKjJOQGi1MCG 8oJg== X-Gm-Message-State: ALyK8tKK9iRH2D0fZkCFX+WWJ2iWsi8Ezdw4OXm+QquZzTHGriCISzdWSQ5mVqNDzN5ovvwY8HeEKCQQoSm+7A== X-Received: by 10.28.144.80 with SMTP id s77mr13343194wmd.41.1466681966423; Thu, 23 Jun 2016 04:39:26 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <639b00e0-7b9d-4ed4-96ad-6afbcd536786@googlegroups.com> Xref: csiph.com comp.lang.python:110406 On Thu, Jun 23, 2016 at 8:15 PM, BartC wrote: > Actually pretty much any expression can be used, because Python can > interpret almost anything as either True or False. Don't ask for the rules > because they can be complicated, but for example, zero is False, and any > other number is True. I think. The rules are very simple. Anything that represents "something" is true, and anything that represents "nothing" is false. An empty string, an empty list, an empty set, and the special "None" object (generally representing the absence of some other object) are all false. A string with something in it (eg "Hello"), a list with something in it (eg [1,2,4,8]), etc, etc, are all true. ChrisA