Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Gregory Ewing Newsgroups: comp.lang.python Subject: Re: Why Python 3? Date: Tue, 22 Apr 2014 18:03:32 +1200 Lines: 31 Message-ID: References: <7x8ur1esa5.fsf@ruckus.brouhaha.com> <535493d4$0$29993$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net WZK5hGyEuTeR7kOublnQTgKNAiBIygq+/5LtebnKXEGkbiuBqD Cancel-Lock: sha1:VPgV8zxMhFXEG/sMEiLh7NeJaY8= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: Xref: csiph.com comp.lang.python:70484 Chris Angelico wrote: > As it > is, we have the case that most lowish integers have equivalent floats > (all integers within the range that most people use them), and beyond > that, you have problems. No, I don't. I'm not talking about representing ints using floats, I'm talking about representing floats using ints. *Every* possible integer-valued float value can be written exactly as a Python int. It doesn't matter that there are some ints that can't be represented as floats, because when I'm writing an int literal as a shorthand for a float, I'm not going to be using any of those values -- or if I do, I'm willing to accept the resulting loss of precision, because in my mind they're *not* ints, they're floats. > But > would you rather have to deal with the problem straight away, or when > your program is some day given a much bigger number to swallow, and it > quietly rounds it off to the nearest multiple of 8? I don't understand what problem you're imagining here. Any program that needs to do exact calculations with integer values should work with ints throughout and use // or divmod() if it needs to do any division. Nothing will get unexpectedly rounded off then. -- Greg