[Python-ideas] real numbers with SI scale factors

Steven D'Aprano steve at pearwood.info
Sun Aug 28 23:45:20 EDT 2016


On Sun, Aug 28, 2016 at 08:26:38PM -0700, Brendan Barnwell wrote:
> On 2016-08-28 18:44, Ken Kundert wrote:
> >When working with a general purpose programming language, the above numbers
> >become:
> >
> >     780kpc -> 7.8e+05
[...]

For the record, I don't know what kpc might mean. "kilo pico speed of 
light"? So I looked it up using units, and it is kilo-parsecs. That 
demonstrates that unless your audience is intimately familiar with the 
domain you are working with, adding units (especially units that aren't 
actually used for anything) adds confusion.

Python is not a specialist application targetted at a single domain. It 
is a general purpose programming language where you can expect a lot of 
cross-domain people (e.g. a system administrator asked to hack on a 
script in a domain they know nothing about).

> 	You've continually repeated this assertion, but I don't buy it.  For 
> the general case, exponential notation is easier to read because you can 
> always see exactly what the exponent is as a number.  To read SI units, 
> you have to know all the SI prefixes.  This may well be common within 
> scientific communities, but to say that it is "easier" is really a bit 
> much.  The same is true of "harder to type".  "kpc" is three characters; 
> e+5 is also three (note that you don't need to write e+05), 

You don't have to write e+5 either, just e5 is sufficient.

> and one of 
> those is a number that transparently indicates how many places to move 
> the decimal, whereas all of the letters in "kpc" are opaque unless you 
> already know what the number is meant to represent.
> 
> 	If you have concrete evidence (e.g., from actual user experience 
> research) showing that it is across-the-board "easier" to read or type 
> SI prefixes than exponential notation, that would be good to see.

I completely believe Ken that within a single tightly focussed user 
community, using their expected conventions (including SI prefixes) 
works really well. But Python users do not belong to a single tightly 
focussed user community.



-- 
Steve


More information about the Python-ideas mailing list