Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '16,': 0.03; 'argument': 0.04; 'string.': 0.04; '"if': 0.09; 'okay': 0.09; 'subject:while': 0.09; 'ignore': 0.13; 'language': 0.14; 'boolean': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'personally,': 0.16; 'mon,': 0.16; 'string': 0.17; 'wrote:': 0.17; 'received:209.85.214.174': 0.21; 'explicit': 0.22; 'header:In- Reply-To:1': 0.25; 'in.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'argue': 0.29; "i'm": 0.29; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'why': 0.37; 'quite': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'apply': 0.39; 'received:209.85.214': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'skip:n 10': 0.63; 'choose': 0.65; 'jul': 0.65; 'conversion?': 0.84; 'rick': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=F+RmFMO5wS47S6g6ZTqL0HRRfB5zjBFuGyfmM6sp7/Q=; b=PYKHiuCptf2rAkPc4OFBaUAP/CIYiSNVb+8mtKeZ0Q10mrEcRKp8HYzlmZS84k98LI dpkOVQ9Ovo7kr8/0apoBjE7gkrWg0cFGXzxA31amoLuyy2SeSRRTbByLoWPcrV34vygY fQEtuBiOaZ/FdcpcL9Lt+untGodnfcB1ga80IXp+N+lJvEZ3CUNGkYrV4NLIC6x85iwy I+lUqApKDKm0dvjNksGLlTYm1nFOtx2xQZkVpeLJJVodryBePnx4hsREi6xrrbrOlo2r VXbt8GupwintPbiqNQjIG4jq7+JSFG/jOGeJ2MaDgG0GV01U2SODA+M7Dsip3As56S1v vzAA== MIME-Version: 1.0 In-Reply-To: References: <5002a1f9$0$29995$c3e8da3$5496439d@news.astraweb.com> <7b027612-a07e-40f9-8ad2-3e95c5440482@googlegroups.com> <86872ad2-fda0-403b-9f18-d1cb18e41860@t32g2000yqd.googlegroups.com> <50038364$0$29995$c3e8da3$5496439d@news.astraweb.com> <50039698$0$29978$c3e8da3$5496439d@news.astraweb.com> Date: Mon, 16 Jul 2012 16:00:06 +1000 Subject: Re: Implicit conversion to boolean in if and while statements From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342418416 news.xs4all.nl 6868 [2001:888:2000:d::a6]:48482 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25396 On Mon, Jul 16, 2012 at 3:03 PM, Ranting Rick wrote: > But if you are going to argue that "if obj" is *explicit enough*, then > apply your argument consistently to "String"+1.75 also. Why must we be > explicit about string conversion BUT not boolean conversion? Can you > reduce this to the absurd? Or will you just choose to ignore this > valid point? Personally, I'm quite okay with automatic upcasts to string. But if you want to be explicit, particularly with floats, the solution often is not to use str(), but a proper number-formatting routine. You want "String%f"%1.75 for full power. But when you're just letting the language do the translation, it's much of a muchness whether you put an explicit toString() call in. ChrisA