Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!feeder2.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'compiler': 0.07; 'francis': 0.07; 'subject:while': 0.07; 'python': 0.08; 'erik': 0.09; 'false,': 0.09; 'am,': 0.12; 'received:209.85.210.174': 0.13; 'received:mail-iy0-f174.google.com': 0.13; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'know;': 0.16; 'latter,': 0.16; 'lookup': 0.16; '\xa0in': 0.16; 'wrote:': 0.16; 'jan': 0.19; 'programming': 0.20; '(or': 0.22; 'assume': 0.22; 'header:In-Reply-To:1': 0.22; '\xa0if': 0.23; 'code': 0.25; 'looks': 0.27; 'concern': 0.28; "who's": 0.28; 'message-id:@mail.gmail.com': 0.28; '(even': 0.28; '22,': 0.30; 'sun,': 0.30; 'quite': 0.31; 'do.': 0.31; 'words,': 0.32; 'to:addr :python-list': 0.33; 'too': 0.34; 'rather': 0.34; 'someone': 0.34; "we're": 0.34; 'puts': 0.34; 'shorter': 0.34; 'here,': 0.34; 'something': 0.35; 'bound': 0.36; 'but': 0.37; "there's": 0.37; 'received:google.com': 0.37; 'some': 0.38; 'received:209.85': 0.38; 'should': 0.38; 'difficult': 0.39; 'why': 0.39; 'being': 0.39; 'received:209': 0.39; 'doing': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.40; 'according': 0.60; 'kind': 0.62; 'fact,': 0.63; 'special': 0.67; 'evaluate': 0.71; 'defensive': 0.84; 'imagine,': 0.84; '\xa0one': 0.84; 'adults': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=9w3hRyLQcUSZyb5U1WxYE0xvI7K/2ulQ1c1Z4gcd8bA=; b=UtbTlgWL/xS6zNKEskqHRMw3Ohq0hEwbFaHD17FPzjoc6xi77h8A1mPYtZSHUNeYBf BtH3SQXUTzsI6FmpQzaJq15uSoKrDQkB+HVhOQeieTjigubXFIRMNQ7g73cLUAMtblqw YZUy4KpWeYr52HRXFnFjB5gScddwMphVgm+NU= MIME-Version: 1.0 In-Reply-To: References: <4F1AC1D4.2080402@gmail.com> Date: Sun, 22 Jan 2012 09:13:23 +1100 Subject: Re: while True or while 1 From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1327184007 news.xs4all.nl 6931 [2001:888:2000:d::a6]:54731 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19196 On Sun, Jan 22, 2012 at 8:13 AM, Erik Max Francis wrote: > Why this should concern anyone, I don't know; someone who's rebound `True= ` > or `False` to evaluate to something other than true and false, respective= ly, > is only doing so to be difficult (or very foolish). =A0One of the princip= les > of Python programming is that We're All Adults Here, so this kind of > defensive programming is really superfluous. =A0In other words, yes, it's > quite reasonable to assume that (even in Python 2) `True` is bound to > something which is, in fact, true. Yes, but there's no special code in the compiler to handle True - it's just a name like any other. It finds a token that looks like a name, so it puts a name lookup into the bytecode. > The real reason people still use the `while 1` construct, I would imagine= , > is just inertia or habit, rather than a conscious, defensive decision. = =A0If > it's the latter, it's a case of being _way_ too defensive. Ehh, 'while 1' is shorter too. I reckon some people are just lazy :) Or have come from C where 'while (1)' is the normal thing to do. According to the Eliza Effect, supporting 'while 1' is a Good Thing. ChrisA