Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed10.multikabel.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.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: OK 0.049 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'terry': 0.07; 'modulo': 0.09; 'am,': 0.12; 'arithmetic.': 0.16; 'e.g': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'nick': 0.16; 'reedy': 0.16; 'subject:syntax': 0.16; 'wrote:': 0.18; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; "i'm": 0.26; 'fact': 0.27; 'message-id:@mail.gmail.com': 0.28; 'assuming': 0.29; 'fairly': 0.30; 'arithmetic': 0.30; 'does': 0.32; 'tue,': 0.32; 'done': 0.34; 'to:addr:python-list': 0.34; 'checking': 0.34; 'something': 0.35; 'equal': 0.36; 'but': 0.37; 'received:google.com': 0.37; "there's": 0.37; 'received:209.85': 0.38; 'should': 0.39; 'being': 0.39; 'received:209': 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'here': 0.65; 'received:209.85.216.174': 0.80; 'calculations': 0.84; 'sum': 0.89; 'sum,': 0.91; 'readily': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=G0qjTZjpdADEnv5jdH98R4rDVzcZ32r1VmY9ZxPAQPQ=; b=Vf5Xo0CR8xw+RS983UxdBtWLm5fmgO1hDai6gPCq1Sh3bLhYyXgQfcz+M0sy+znhbB TweE2nSXt21zoZ6hQiaGNpmWVJ1SR09ZqwCdw1ua2PcCDmYMyum33AbhOFM+1Y6jLkdJ /AnD8OuqMjyCsqe3gqyR7ToB0RU1vwQ8nFa2M= MIME-Version: 1.0 In-Reply-To: <26632.1323705344@alphaville.dokosmarshall.org> References: <4ee554a3$0$11091$c3e8da3@news.astraweb.com> <9klr6aF2ovU1@mid.individual.net> <26632.1323705344@alphaville.dokosmarshall.org> Date: Tue, 13 Dec 2011 03:16:08 +1100 Subject: Re: Verbose and flexible args and kwargs syntax 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1323706576 news.xs4all.nl 6925 [2001:888:2000:d::a6]:42512 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17057 On Tue, Dec 13, 2011 at 2:55 AM, Nick Dokos wrote: > Terry Reedy wrote: >> calculations are helped by the fact that (a+b) % c == a%c + b%c, so > > As long as we understand that == here does not mean "equal", only > "congruent modulo c", e.g try a = 13, b = 12, c = 7. This is the basis of the grade-school "casting out nines" method of checking arithmetic. Set c=9 and you can calculate N%c fairly readily (digit sum - I'm assuming here that the arithmetic is being done in decimal); the sum of the remainders should equal the remainder of the sum, but there's the inherent assumption that if the remainders sum to something greater than nine, you digit-sum it to get the true remainder. (Technically the sum of the digits of a base-10 number is not the same as that number mod 9, but if you accept that 0 == 9, it works fine.) ChrisA