FW: [Numpy-discussion] Bug: extremely misleading array behavior

Perry Greenfield perry at stsci.edu
Mon Jun 10 12:07:15 CDT 2002


<Paul Dubois writes>: 
> 
> We have certainly beaten this topic to death in the past. It keeps
> coming up because there is no good way around it. 
> 
Ain't that the truth.

> Two points about the x + 1.0 issue: 
> 
> 1. How often this occurs is really a function of what you are doing. For
> those using Numeric Python as a kind of MATLAB clone, who are typing
> interactively, the size issue is of less importance and the easy
> expression is of more importance. To those writing scripts to batch
> process or writing steered applications, the size issue is more
> important and the easy expression less important. I'm using words like
> less and more here because both issues matter to everyone at some time,
> it is just a question of relative frequency of concern.
> 
We have many in the astronomical community that use IDL (instead
of MATLAB) and for them size is an issue for interactive use. They
often manipulate very large arrays interactively. Furthermore, many
are astronomers who don't generally see themselves as programmers
and who may write programs (perhaps not great programs) don't
want to be bothered by such details even in a script (or they may
want to read a "professional" program and not have to deal with
such things). But you are right in that there is no solution that 
doesn't have some problems.

Every array language deals with this in somewhat different ways I
suspect. In IDL, the literals are generally smaller types (ints were
(or used to be, I haven't used it myself in a while) 2 bytes, floats
single precision) and there were ways of writing literals with higher
precision (e.g., 2L, 2.0d-2). Since it was a language specifically
intended to deal with numeric processing, supporting many scalar types
made sense.

Perry





More information about the Numpy-discussion mailing list