Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4a.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'root': 0.05; 'say,': 0.05; 'extent': 0.07; 'incompatible': 0.07; 'matches': 0.07; 'counting': 0.09; 'lines.': 0.09; 'subject:test': 0.09; 'missed': 0.12; 'bug:': 0.16; 'finney': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'silly': 0.16; 'there?': 0.16; 'unhelpful': 0.16; 'values?': 0.16; ':-)': 0.16; 'wrote:': 0.18; "python's": 0.19; 'header:User-Agent:1': 0.23; 'question': 0.24; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'bigger': 0.30; 'important.': 0.30; "i'm": 0.30; 'that.': 0.31; 'are.': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'values.': 0.31; 'writes:': 0.31; 'there.': 0.32; 'quite': 0.32; 'could': 0.34; 'connection': 0.35; 'received:84': 0.35; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'false': 0.36; 'method': 0.36; 'wrong': 0.37; 'two': 0.37; 'sometimes': 0.38; 'ben': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'course.': 0.60; 'expression': 0.60; 'such': 0.63; 'sum': 0.64; 'total': 0.65; 'different': 0.65; 'between': 0.67; 'asked.': 0.84; 'beats': 0.84; 'unclear': 0.84; 'subject::': 0.85 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=ceBcrxzM c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=aoAcgTy3oA8A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=kZ7UWmmPAAAA:8 a=TN1kF7JGK7I3T1ZyLPoA:9 a=kyqzuccb8SjU_klM:21 a=vr-j89HVgK3rw6iL:21 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett:2500 Date: Mon, 27 Oct 2014 01:40:29 +0000 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: (test) ? a:b References: <54476af8$0$21651$426a74cc@news.free.fr> <7839376e-fc27-4299-ae63-4ddf17ef9a8a@googlegroups.com> <7d2ea3c1-504e-4f5c-8338-501b1483df38@googlegroups.com> <878uk6x5nd.fsf@elektro.pacujo.net> <544a1016$0$13000$c3e8da3$5496439d@news.astraweb.com> <544b2f15$0$12978$c3e8da3$5496439d@news.astraweb.com> <544c3bde$0$12988$c3e8da3$5496439d@news.astraweb.com> <544c754b$0$12991$c3e8da3$5496439d@news.astraweb.com> <854muq2vpm.fsf@benfinney.id.au> In-Reply-To: <854muq2vpm.fsf@benfinney.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414374034 news.xs4all.nl 2971 [2001:888:2000:d::a6]:47112 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79742 On 2014-10-27 00:38, Ben Finney wrote: > Steven D'Aprano writes: > >> Do you really not see the connection between counting and summing? > > Connection? Of course. But I also see a huge distinction. I'm surprised > you could misunderstand my position to the extent you think such a > question needs to be asked. > > The difference between “sum these values” versus “count these values” is > important. That's at the root of why I find it confusingly wrong to sum > True or False values. > > Do you really not see the distinction between counting and summing? > > The question is just as silly that way. > >> If you have three apples, and I have two apples, then in total we have >> (count the apples: one two three, four five) five apples. > > If you have three apples in one basket, and I have two apples in one > basket, “sum the baskets” is quite a different operation from “count the > baskets”. > > [3, 2] > > What is the sum of those values? > > How many values are there? > Those are ints. The question is whether you can sum bools. Python's way is to say that it's counting how many True there are. Sometimes it's useful; pragmatism beats purity, and all that. > The distinction between those is why I find it unhelpful to express “how > many values?” with “sum them”. > >> Alas, you missed the bigger bug: I'm counting *blank lines*, not >> non-blank lines. You need a `not` in there. > > Which is, shall we say, not incompatible with the position that the > “count the matches by summing bools” method is an unclear expression of > intent :-) >