[Numpy-discussion] rank-0 arrays

Perry Greenfield perry at stsci.edu
Fri Sep 13 14:07:02 EDT 2002


> Hi Perry,
> 
> I like Travis's proposal the best of those I've seen so far, but I don't
> recall the details of Eric's problem. Could you refresh us as to 
> the basics
> of it?.
> 
> -tim
> 
On a different front, I'm not sure that this proposal is very useful
for numarray because of the new scalar/array coercion rules that
numarray has. Since the new scalar literals must still use 
type functions (e.g.,, Int8(2)) it doesn't help make expressions
any prettier (or do I misunderstand the proposal?). In returning
scalars from arrays, I don't see that converting the array type
to a Python scalar type helps much. With the exception of long
doubles (and the corresponding complex precision), the conversion
to the python scalar doesn't lose any precision and you can 
restore the exact array type value by assigning that scalar value
back to an array element. As mentioned, the only exception is for
long doubles; for that case, a new scalar type makes sense.

Is there any other compelling reason for new scalar types?

Perry




More information about the NumPy-Discussion mailing list