Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'subject:Python': 0.05; 'feature.': 0.07; 'python': 0.09; 'bool': 0.09; 'integers': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'extension': 0.13; 'language': 0.14; 'dec': 0.15; 'represents': 0.15; 'boolean': 0.16; 'dump': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'statement)': 0.16; 'tape': 0.16; 'odd': 0.17; 'creates': 0.18; 'code,': 0.18; 'feb': 0.19; 'define': 0.20; 'bit': 0.21; 'example': 0.23; 'errors': 0.23; 'least': 0.25; 'skip:" 20': 0.26; 'url:wiki': 0.26; 'header:X-Complaints-To:1': 0.28; 'trouble': 0.28; 'optional': 0.29; 'strings,': 0.29; 'url:wikipedia': 0.29; 'objects': 0.29; 'fri,': 0.30; 'error': 0.30; 'point': 0.31; '(and': 0.32; 'implement': 0.32; 'instruction': 0.32; 'could': 0.32; 'info': 0.32; 'url:home': 0.33; 'to:addr:python-list': 0.33; 'languages': 0.33; 'wrong': 0.34; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'url:org': 0.36; 'should': 0.36; 'too': 0.36; 'charset:us-ascii': 0.36; 'problems': 0.36; 'itself': 0.37; 'does': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'positive': 0.38; 'url:en': 0.38; 'to:addr:python.org': 0.39; 'short': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'end': 0.40; 'think': 0.40; 'back': 0.62; 'engines': 0.62; 'different': 0.63; 'skip:n 10': 0.63; 'email addr:gmail.com': 0.63; 'today,': 0.64; 'treat': 0.65; 'applying': 0.69; '2013': 0.84; 'dennis': 0.91; 'mean.': 0.91; 'story.': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Python Newbie Date: Sat, 23 Feb 2013 13:29:27 -0500 Organization: > Bestiaria Support Staff < References: <5127848B.1060004@gmail.com> <928d2cf7-728b-4f35-b8c9-4c9b958507e5@googlegroups.com> <8eadd52c-d533-4333-8c7f-7bf3a6d7b046@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-253-107-131.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES 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: 46 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361644177 news.xs4all.nl 6928 [2001:888:2000:d::a6]:48770 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39694 On Fri, 22 Feb 2013 15:38:53 -0800 (PST), piterrr.dolinski@gmail.com declaimed the following in gmane.comp.python.general: > if (some statement): # short form > > in the example I gave, but you figured exactly what I mean. Of course if the condition (some statement) is boolean there is no point adding "== true" or similar. But if (some statement) represents a value this is where I have trouble and again the origins of this date back to when Python had no boolean type. So now at least I understand it. > Python isn't the only language that will treat non-Boolean as Boolean, though applying it to strings, floats, other objects may be an extension (and one which does simplify a lot of code, in my view). Error codes under DEC VAX/VMS used odd integers for "success/information" and even integers for "warning/error" (been too many years, I think positive integers were success/warning, negative integers were information/error; I could also be wrong on which set were even... if 0 were no-info/success then odd were errors and even were success)). The VAX instruction set only used the least significant bit for Boolean checks, so one could do a fast check by if (retCode) then #assume odd are errors #examine for "correctible" error codes #or dump an exception else #assume we don't care for specific info messages #a la: tape already at beginning, if the operation was a rewind #do normal processing end if > Btw, there are still languages with no boolean type today, MySQL for one. This creates big efficiency problems when fetching data from the database into a C# program - what should be a bool is fetched as an 8-byte integer! But that's a different story. I shut up now. > SQL itself did not define a Boolean type until the 1999 standard -- and in that standard, Boolean is an optional feature. http://en.wikipedia.org/wiki/Boolean_data_type#SQL Apparently few database engines implement a true Boolean. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/