Path: csiph.com!usenet.pasdenom.info!news.albasani.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Gregory Ewing Newsgroups: comp.lang.python Subject: Re: Why Python 3? Date: Sun, 20 Apr 2014 13:06:47 +1200 Lines: 36 Message-ID: References: <7x8ur1esa5.fsf@ruckus.brouhaha.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net Z2ZQ3iVqUTilzO0NJTRItwOR/qlgA+J9dqcuRFHXDAk17a48oT Cancel-Lock: sha1:c/9ZsOo0ft3QyjmvfSxChzgnBSY= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: Xref: csiph.com comp.lang.python:70400 Chris Angelico wrote: > I'd rather have to explicitly request floating-point division; When you write / in Python 3, you *are* explicitly requesting floating-point division. Similarly, when you write // you're explicitly requesting integer division. I don't see the problem. You write whatever you mean and it does what you tell it to do. > So either you keep a very close eye on everything to make sure you > don't have floats infecting your calculations, If you have something that works exclusively on ints and someone passes you a float, and you don't check for that, you'll have problems anyway even if no division is involved at all. There's no way that Python 3 division can *introduce* a float into an integer calculation unless you write / somewhere where you really meant //. But that's the same kind of mistake as calling foo() when you meant to call bar(). You can't blame the language for that. > but if you > encode the date into the first eight digits, then put the store number > in the next three, register number in the next three, and then the > last three are sequential. Should work the same, right?) It'll work fine as long as you use // when extracting the parts. If you use / then you're *explicitly* saying to do the calculation in floating point, which would not be a sane thing to do. -- Greg