[Python-ideas] real numbers with SI scale factors

Ken Kundert python-ideas at shalmirane.com
Mon Aug 29 03:07:58 EDT 2016


On Mon, Aug 29, 2016 at 01:45:20PM +1000, Steven D'Aprano wrote:
> 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).

I talked to astrophysicist about your comments, and what she said was:
1. She would love it if Python had built in support for real numbers with SI 
   scale factors
2. I told her about my library for reading and writing numbers with SI scale 
   factors, and she was much less enthusiastic because using it would require 
   convincing the rest of the group, which would be too much effort.
3. She was amused by the "kilo pico speed of light" comment, but she was adamant 
   that the fact that you, or some system administrator, does not understand 
   what kpc means has absolutely no affect on her desired to use SI scale 
   factors. Her comment: I did not write it for him.
4. She pointed out that the software she writes and uses is intended either for 
   herself of other astrophysicists. No system administrators involved.

> > 	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.

You think that Python is only used by generalists?  That is silly. Have you seen 
SciPy? If you think that, take a look at Casa (casaguides.nrao.edu). It is 
written by astrophysicists for astrophysicists doing observations on radio 
telescope arrays. That is pretty specialized.

-Ken



More information about the Python-ideas mailing list