Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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; 'function,': 0.07; 'wrapper': 0.07; 'python': 0.08; 'be:': 0.09; 'exceptions': 0.09; 'am,': 0.12; 'library': 0.13; 'subject:was': 0.15; 'subject: \n ': 0.16; 'subject:syntax': 0.16; 'cc:addr:python-list': 0.16; 'wed,': 0.17; 'wrote:': 0.18; '>>>': 0.18; 'have:': 0.18; 'cc:no real name:2**0': 0.20; 'subject:not': 0.21; 'dec': 0.22; 'header:In- Reply-To:1': 0.22; 'division': 0.23; 'module,': 0.23; 'though.': 0.23; 'math': 0.24; 'cc:2**0': 0.24; 'module': 0.26; 'message- id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'semantics': 0.30; 'subject:]': 0.32; 'there': 0.33; 'probably': 0.34; 'elegant': 0.34; 'integer': 0.34; 'totally': 0.35; 'but': 0.37; 'received:google.com': 0.37; 'think': 0.37; 'could': 0.37; 'steven': 0.38; 'some': 0.38; 'received:209.85': 0.38; 'define': 0.39; "it's": 0.40; 'received:209': 0.40; 'might': 0.40; '2011': 0.61; 'happy.': 0.84; 'thin': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=WK8dcyhwCSXYYyO9bwa8kYsNbBF5UVadq/7/dbSbch4=; b=gpDNQQQ3g9z1r08i4JJPL3Hy6LDoktzJRxNvbPe+TU51feFveaf+uAP2Gzkv13CpUG FIqagEk6ja9o0CpBRrfnvVubgdkl6SCHOJiY39xp002iZfmlVdYV6a7o7mzBrT3dMFCC 0JyF5Wipl8l2qzQPSWKcxJk761+2kQWypsYZE= MIME-Version: 1.0 In-Reply-To: <0d38ea3b-46ff-4fbc-9a1c-8e028c3a7d8b@n10g2000vbg.googlegroups.com> References: <4ee81592$0$11091$c3e8da3@news.astraweb.com> <78d2ba1b-0ea2-49a8-88f4-d85186bb2317@f11g2000yql.googlegroups.com> <4ee898c6$0$29979$c3e8da3$5496439d@news.astraweb.com> <0d38ea3b-46ff-4fbc-9a1c-8e028c3a7d8b@n10g2000vbg.googlegroups.com> From: Ian Kelly Date: Wed, 14 Dec 2011 08:45:04 -0700 Subject: Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] To: Eelco Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1323877538 news.xs4all.nl 6905 [2001:888:2000:d::a6]:54568 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17218 On Wed, Dec 14, 2011 at 6:29 AM, Eelco wrote: > On Dec 14, 1:38=A0pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: >> On Wed, 14 Dec 2011 02:09:32 -0800, Eelco wrote: >> > Arguably, the most elegant thing to do is to define integer division a= nd >> > remainder as a single operation; which is not only the logical thing t= o >> > do mathematically, but might work really well programmatically too. >> >> > The semantics of python dont really allow for this though. One could >> > have: >> >> > d, r =3D a // b >> >> That would be: >> >> >>> divmod(17, 5) >> >> (3, 2) > > Cool; if only it were in the math module id be totally happy. Probably it's not in math because it's not a thin wrapper around a C math library function, which is how the module was conceived. There are already some exceptions in the math module, but I think they are all newer than divmod.