Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!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: UNSURE 0.237 X-Spam-Level: ** X-Spam-Evidence: '*H*': 0.55; '*S*': 0.02; 'jan': 0.12; 'wrote': 0.14; '1:08': 0.16; 'be:': 0.16; 'navigation': 0.16; 'really?': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'fit': 0.20; '"you': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'lot.': 0.31; 'probably': 0.32; 'quite': 0.32; "i'd": 0.34; 'something': 0.35; 'received:google.com': 0.35; 'example,': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'dave': 0.60; 'course': 0.61; "you're": 0.61; 'kind': 0.63; 'skip:n 10': 0.64; 'more': 0.64; '30,': 0.65; 'here': 0.66; 'satellite': 0.68; 'score': 0.74; "'you": 0.84; 'precious': 0.84; 'angel': 0.91; 'subject:True': 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:to :content-type; bh=IvVVpN7pk3y502sjm+vxDme61nfdY15cF/HVEE2dwEc=; b=0+bQT7LmzOPyi/jmVnl9LrKYUhpaufzIN1/T+KUwx1IpSkt7icUbU2zoPZ3AQm6NPn B966gCBIie6+x9x2fGKwfS4nXFTb2/11Oj+HSexu4ceWfy7dULH4sDAPcimffoNLo35K ZXYciiTGm25sQDEXvkTDkLWC7HEUSrGu1leICDpy/aJRvKmyTmwviytlhPB1GptSQyVg vMkTvgo21ghv3AmLUARXCWQ/YyVsyoFv2PQj7WuJVfS75EEVlaDj8Rcc4PmJW/KVXwI3 yDZGSC8tZGmn4NtaqwCmPcTSGC1rLiL4nzplzmSDHk/f/+TlERJG7ftaxVTWPnpfd2vN RMvw== X-Received: by 10.66.141.144 with SMTP id ro16mr16266169pab.131.1391113727992; Thu, 30 Jan 2014 12:28:47 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <99b0aa22-5fb3-460a-a080-dacb1c0f2fda@googlegroups.com> From: Ian Kelly Date: Thu, 30 Jan 2014 13:28:07 -0700 Subject: Re: 1 > 0 == True -> False To: Python Content-Type: text/plain; charset=ISO-8859-1 X-Mailman-Approved-At: Thu, 30 Jan 2014 21:29:50 +0100 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391113791 news.xs4all.nl 2848 [2001:888:2000:d::a6]:57725 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65048 On Thu, Jan 30, 2014 at 1:08 PM, Dave Angel wrote: > Rotwang Wrote in message: >> Really? I take advantage of it quite a lot. For example, I do things >> like this: >> >> 'You have scored %i point%s' % (score, 's'*(score != 1)) >> > > I also did that kind of thing when computer resources > were more > precious the program readability. Like in 73 when my satellite > navigation system had to fit in 2k code and 1.5k > data. > > Here I'd probably do something like > > 'You have scored {} {}' .format (score, 'point' if score==1 else > 'points') Of course if you're at all concerned about i18n then the proper way to do it would be: ngettext("You have scored %d point", "You have scored %d points", score) % score