[Python-ideas] Python Numbers as Human Concept Decimal System

Andrew Barnert abarnert at yahoo.com
Wed Mar 5 21:32:38 CET 2014


From: Oscar Benjamin <oscar.j.benjamin at gmail.com>

Sent: Wednesday, March 5, 2014 3:29 AM


> On 5 March 2014 08:10, Andrew Barnert <abarnert at yahoo.com> wrote:
>>  From: Mark H. Harris <harrismh777 at gmail.com>
>>> 
>>>    I am expecting that (just as in Rexx numbers) defining very clearly 
> what
>>> is a python number  will be key for wide adaptation of the concept. But 
> there
>>> should be no surprises for users, particularly average users. Anyone 
> with
>>> a middle school expectation of a numeric format should be able to use
>>> python numbers without surprises.
>> 
>>  Anyone with a middle school expectation will expect 1/3 to be a 
> fraction--or, at least, something they can multiply by 3 to get exactly 1. Using 
> an inexact decimal float instead of an inexact binary float is no improvement at 
> all.
> 
> I actually think that it is an improvement. Most people are surprised
> by the fact that just writing x = 0.1 causes a rounding error. Python
> only has dedicated syntax for specifying binary floats in terms of
> decimal digits meaning that there is no syntax for exactly specifying
> non integer numbers. I would say that that is clearly a sub-optimal
> situation.
> 
> I don't agree with Mark's proposal in this thread but I would like to
> have decimal literals e.g. 1.23d, and I would also use Fraction
> literals if available e.g. 1/3F.


I agree with you completely on that. That's kind of my point—your suggestion is almost the _opposite_ of the proposal in this thread. You want to make it easier for people to use the appropriate type for each use case; he wants to eliminate that choice entirely so you never have to make it. The latter would be nice if it were doable, but it's not even possible in principle. So the former is the best choice.



More information about the Python-ideas mailing list