Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.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.032 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'that?': 0.05; 'spaces': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; "'s')": 0.16; 'both,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'imo.': 0.16; 'operators,': 0.16; 'spacing': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; '31,': 0.24; 'instance,': 0.24; 'cc:2**0': 0.24; 'least': 0.26; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; 'operators': 0.31; 'probably': 0.32; 'bugs': 0.33; 'fri,': 0.33; "i'd": 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'either': 0.39; 'space': 0.40; 'dave': 0.60; 'more': 0.64; 'here': 0.66; "'you": 0.84; "it'd": 0.84; 'angel': 0.91; 'subject:True': 0.91; 'to:none': 0.92 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:cc :content-type; bh=bTvG7bSMtXRUK0lLNYCr+WAe7Va1yOEmjPEFCFya40o=; b=zTx8A+qfkXtTd09SbtjZY/+73E6Mss1oyfu2UVkfhgxbEljD6rmfbCOjsW7MFX7j86 vqt/z6fuWxqgzRIhthQfP9bQtWHDBj1ypp6KQqRkFQ3gKB68mPlQZZAwy6xXrZ0czHx1 vlu/ocvQNGPL5VNjr+xbpS7sA+HX8KbvDXR9fcDGtv02DmcxNo5Lfdn/XzdTp/f0XdyA ifMKJXSCmd0cE24gqJq1aRwSS+5rgiTNXezz6BNrVf2Sb4+5i7H9gvvP+6ltt5Au0nBd AalYO8Ig5T1u0cpJCHnoAemWNu/UZ7nLDj8sVFL+t0yCyhChKvF2mYGuRw42V3yoZ0i6 CTzw== MIME-Version: 1.0 X-Received: by 10.68.108.194 with SMTP id hm2mr16668310pbb.22.1391112948729; Thu, 30 Jan 2014 12:15:48 -0800 (PST) In-Reply-To: References: <99b0aa22-5fb3-460a-a080-dacb1c0f2fda@googlegroups.com> Date: Fri, 31 Jan 2014 07:15:48 +1100 Subject: Re: 1 > 0 == True -> False From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391112952 news.xs4all.nl 2877 [2001:888:2000:d::a6]:48790 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65046 On Fri, Jan 31, 2014 at 7:08 AM, Dave Angel wrote: >> 'You have scored %i point%s' % (score, 's'*(score != 1)) >> > > Here I'd probably do something like > > 'You have scored {} {}' .format (score, 'point' if score==1 else > 'points') Bah, what's the fun in that? 'You have scored %i point%.*s' % (score, score!=1, 's') BTW, the layout of the original bugs me slightly: >> 'You have scored %i point%s' % (score, 's'*(score != 1)) I don't like having spaces around != and none around *. I'd either squash the != up or space out the *: 'You have scored %i point%s' % (score, 's'*(score!=1)) 'You have scored %i point%s' % (score, 's' * (score != 1)) Operators should always have at least as much space around them as more tightly-binding operators, IMO. In this instance, it'd be reasonable to squash the != and space the *, or to squash both, or to space both, but not the "backward" spacing of the original :) But that's just my opinion. ChrisA