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

Oscar Benjamin oscar.j.benjamin at gmail.com
Wed Mar 5 12:29:10 CET 2014


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.


Oscar


More information about the Python-ideas mailing list