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: Mon, 23 May 2016 08:49:12 -0600 Lines: 31 Message-ID: References: <573f9322$0$1616$c3e8da3$5496439d@news.astraweb.com> <5741cde9$0$1587$c3e8da3$5496439d@news.astraweb.com> <57422e03$0$1596$c3e8da3$5496439d@news.astraweb.com> <85r3ct9zt2.fsf@benfinney.id.au> <5742bacb$0$1526$c3e8da3$5496439d@news.astraweb.com> <87zirgrgol.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 2N0SdVYGRT+NRwUvVVHrVAh9U3YY6gIMc7Rwqoh1c3sA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'binary': 0.05; 'defines': 0.07; 'subject:while': 0.09; 'received:209.85.218': 0.10; 'thread': 0.10; 'python': 0.10; '(0)': 0.13; '*should*': 0.16; '2016': 0.16; '23,': 0.16; 'anybody.': 0.16; 'languages)': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:make': 0.16; 'third,': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'saying': 0.22; 'shifting': 0.22; 'programming': 0.22; 'am,': 0.23; 'defined': 0.23; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'example': 0.26; 'sense': 0.26; 'point.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'idea': 0.28; 'initial': 0.28; 'thread,': 0.29; "i'm": 0.30; "i'd": 0.31; 'guess': 0.31; 'another': 0.32; 'problem': 0.33; "d'aprano": 0.33; 'picking': 0.33; 'point,': 0.33; 'steven': 0.33; 'received:google.com': 0.35; 'quite': 0.35; 'something': 0.35; "isn't": 0.35; 'sometimes': 0.35; 'but': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'say': 0.37; 'received:209': 0.38; 'why': 0.39; 'does': 0.39; "didn't": 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'close': 0.61; 'ago.': 0.61; 'back': 0.62; '2000': 0.63; 'subject: / ': 0.63; 'helping': 0.67; 'miss': 0.77; 'float,': 0.84; 'subject:else': 0.84; 'subject:sense': 0.84; 'to:name:python': 0.84; 'closer.': 0.91; 'new!': 0.93 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=1dIkr6n9cDMJaSWnFABHf7H7lZSOFjayxHuIjzUrunk=; b=YKrvwu3+Eqi9GQN5n7R2hUeVfk5BGdVVJQxoFbiRTmX0GjvdOY69xnwwG9vYBuc7Ch zkugR3oeUDJSOmzF0HFl5nXxDqTJtBCya4Flipg8IeW2IBg82YNNbAPO7m+OmLyo4Mfr P0s7engAs18lNQzDsMdyTmEPLu6nVdv/iaxRJXxc15qdKVGZZpG35OxJcYH0ULwRoB90 0IELXDraz36x8IF0AXr5N5MPtnn0yJwSTG2+wLyhpZQfVRXbuw38vdV+eV+vUSzmqE0P GjWNSjqnNGbVczCM8P2SmNM11tOMDOJGxCQ1YBn8Vto7R8QjL6/z9fMjcC98qkbamsG+ nV1w== 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=1dIkr6n9cDMJaSWnFABHf7H7lZSOFjayxHuIjzUrunk=; b=amWOxjYBZgCqsEVJxOuaKiD6RE6i+Qe0Az8rV1HHVANdJ/yy7H8ZJ9QeBqSyekeqyg ddXzXzb8GPAXIJ76j9wUhmgTkM88LklwbwB/pw3bGWVFN9u3mXKcYTvggUiaQj43CA02 OgAZF2JRnpXwKGN8m2B/T1QK1fx1V9/MQuV+Rj3KZrBwFx40qeTtclL8JHyLWzKRnm9o nnNXodJAD3X21ZyfBJkbJ0NjPRhmGDKI3dTuGvHd5Hbeom7GEG1B5JBekhsvP+bE3eiq guy13HCtXjPu/gbFpi4Ye4QcU/bfXC4DkdfGJ19LpFAZW9iJ5Y7fIRV5FlW2HmoiL65F iVEQ== X-Gm-Message-State: ALyK8tIMnXA9iO494croMUY5ngpOLE4RvZJ42MrcU8uyEA0EXGHXO3vH4HRGvE/+Qtd2+YrYt7odbGbZDLnKEQ== X-Received: by 10.202.213.88 with SMTP id m85mr4409152oig.24.1464014992425; Mon, 23 May 2016 07:49:52 -0700 (PDT) In-Reply-To: <87zirgrgol.fsf@bsb.me.uk> 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: <573f9322$0$1616$c3e8da3$5496439d@news.astraweb.com> <5741cde9$0$1587$c3e8da3$5496439d@news.astraweb.com> <57422e03$0$1596$c3e8da3$5496439d@news.astraweb.com> <85r3ct9zt2.fsf@benfinney.id.au> <5742bacb$0$1526$c3e8da3$5496439d@news.astraweb.com> <87zirgrgol.fsf@bsb.me.uk> Xref: csiph.com comp.lang.python:108997 On Mon, May 23, 2016 at 8:29 AM, Ben Bacarisse wrote: > Ian Kelly writes: > >> On Mon, May 23, 2016 at 2:09 AM, Steven D'Aprano >> wrote: >>> Are you saying that the Egyptians, Babylonians and Greeks didn't know how to >>> work with fractions? >>> >>> http://mathworld.wolfram.com/EgyptianFraction.html >>> >>> http://nrich.maths.org/2515 >>> >>> Okay, it's not quite 4000 years ago. Sometimes my historical sense of the >>> distant past is a tad inaccurate. Shall we say 2000 years instead? >> >> Those links give dates of 1650 BC and 1800 BC respectively, so I'd say >> your initial guess was closer. > > Right, but this is to miss the point. Let's say that 4000 years have > defined 1/3 to be one third, but Python 3 (as do many programming > languages) defines 1/3 to be something very very very very close to one > third, and *that* idea is very very very very new! It's unfortunate > that the example in this thread does not illustrate the main problem of > shifting to binary floating point, because 1/2 happens to be exactly > representable. I'm not going to dig back through the thread, but my recollection is that's exactly why that example was chosen. Since 1/2 can be represented exactly as a float, it *should* be represented as a float. Picking another value (0) that isn't even close to the exact value of 1/2 isn't helping anybody.