Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: for / while else doesn't make sense Date: Sun, 22 May 2016 17:04:11 -0600 Lines: 26 Message-ID: References: <573EC62F.4090401@lucidity.plus.com> <573f9322$0$1616$c3e8da3$5496439d@news.astraweb.com> <5741cde9$0$1587$c3e8da3$5496439d@news.astraweb.com> <1463938237.1828035.615243249.4F306225@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de EWcErFubjqyDPP7vE6YWzwY/i16TUdyDk++NOA2tmc6g== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '**)': 0.09; '22,': 0.09; 'closed.': 0.09; 'exception,': 0.09; 'integers': 0.09; 'subject:while': 0.09; 'received:209.85.218': 0.10; 'python': 0.10; 'argument': 0.15; '"an': 0.16; '2016': 0.16; 'inverse': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'said.': 0.16; 'subject:make': 0.16; 'wrote:': 0.16; 'case.': 0.18; '>>>': 0.20; 'sorry,': 0.22; 'am,': 0.23; '(or': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'mathematical': 0.27; 'correct': 0.28; 'arithmetic': 0.29; 'division': 0.29; 'operators': 0.29; 'subset': 0.29; 'operations': 0.31; 'post': 0.31; '"the': 0.32; 'raising': 0.33; 'symbol': 0.33; 'received:google.com': 0.35; 'returning': 0.35; 'should': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'no,': 0.38; 'received:209': 0.38; 'means': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'entire': 0.61; 'real': 0.62; 'subject: / ': 0.63; 'special': 0.73; 'float,': 0.84; 'premise': 0.84; 'subject:else': 0.84; 'subject:sense': 0.84; 'to:name:python': 0.84 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; bh=huJnMh2AcDB0ncTy45dtGz3trZnp6DoRT8zPWmAVpic=; b=Bm9Wx6mnko1ls4EcELeYL53xwAUFk6owpOGGZzw9t5q/qEpJZ3zW2ru7YdQ5kzGuMs gPgaIHS3NA6e3UTQyMgObmYYEx3tQreeYghsSADKQt1/BYSIhq5lH9uKpNx+HZgqowqS C0DzSPW8TnqnhBYUZmUWKP9U4xj0GL1JvVwKQKWDsp6ZaoYJgXJ4+9VphT890qU3+i/L VCfFoCs/tBsx2cZK4Nl9Ct8KL/TFnI0nvFl2sh8QWRxKU4lE2l1dQGGvThvWUCilp9nA nnp1G6NqWKpau7BenIldCSo7G16KVAbrVMlfb2tquJ8XVw1MC+0DA4C6F3obxKCf72oF 0Trw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=huJnMh2AcDB0ncTy45dtGz3trZnp6DoRT8zPWmAVpic=; b=kd0NhCPZLBorTDXdc8lTOk1cT1GsG19dTj44nQMiDboTLAipiGd7tRXU703KnfWBCb Pv3W5oMvdsDrdTGf7JaH8ImHQxDhoNI1ZgYv2eWFL97pVIHzErKt7H20MTuIr6WtzQtm vYygku9lhyi2pNQoKvLe2KnXtX56vZm0GCCMDmCmVPMK6u4BadZ4a/QTep8Gq6M+gT5d lrxAROO9qhpAM40jZckuy/JMWUs5J6fGOimlgG/jNETHFYT8u+ekNYH1RWcxD06sXFWK F27mF9JeLlb4PabMMy3WRNmWol1xtDnYbBJr/ELHH4Iry7QKFhlttTO3tN5GOq69wsTZ c5Hg== X-Gm-Message-State: AOPr4FXS2J9LebNcatufg6Ygut8A61S7kgukJ1n/m2wGM4GXUQB3AvtIdNzyhxE72b1l+17OeAqeAxKE5Ryx6A== X-Received: by 10.202.214.208 with SMTP id n199mr7794336oig.144.1463958290919; Sun, 22 May 2016 16:04:50 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <573EC62F.4090401@lucidity.plus.com> <573f9322$0$1616$c3e8da3$5496439d@news.astraweb.com> <5741cde9$0$1587$c3e8da3$5496439d@news.astraweb.com> <1463938237.1828035.615243249.4F306225@webmail.messagingengine.com> Xref: csiph.com comp.lang.python:108966 On Sun, May 22, 2016 at 11:55 AM, Jon Ribbens wrote: > On 2016-05-22, Random832 wrote: >> On Sun, May 22, 2016, at 12:46, Jon Ribbens wrote: >>> Sorry, I have to stop you there as the entire premise of your post is >>> clearly wrong. "int" is not "an approximation of real numbers", it's >>> a model of the mathematical concept "integers", >> >> It is a representation of Z, a subset of R > > Yes, that's what I just said. "Z" is just (an approximation of!) > a symbol that means "the set of integers". > >> (as is float, technically, though that particular subset has no nice >> name like Z and Q) The operators that apply to it are the operations >> on R, even operations under which Z (or even R) is not closed. > > No, in Python integers are closed under the standard arithmetic > operators (+ - * / % **) - except, since Python 3, for "/", which > is now a special case. If you want Python integers to be closed under division *and* be mathematically correct then the result of 1 / 2 should be the multiplicative inverse of 2, which is *undefined* in Z. While that might be an argument for raising an exception, it's not in any way a justification of returning 0.