[Numpy-discussion] Numarray header PEP

Gerard Vermeulen gerard.vermeulen at grenoble.cnrs.fr
Thu Jul 1 11:39:08 CDT 2004

On 01 Jul 2004 12:43:31 -0400
Todd Miller <jmiller at stsci.edu> wrote:

> A class of question which will arise for developers is this: "X works
> with Numeric,  but X doesn't work with numaray."  The reverse also
> happens occasionally.  For this reason, being able to choose would be
> nice for developers.
> > So, I prefer: Numeric In => Numeric Out or Numarray In => Numarray Out (NINO)
> > Of course, Numeric or numarray output can be a user option if NINO does not
> > apply.  
> When I first heard it, I though NINO was a good idea,  with the
> limitation that it doesn't apply when a function produces an array
> without consuming any.  But... there is another problem with NINO that
> Perry Greenfield pointed out:  with multiple arguments,  there can be a
> mix of array types.  For this reason,  it makes sense to be able to
> coerce all the inputs to a particular array package.  This form might
> look more like:
> switch(PyArray_Which(<no_parameter_at_all!>)) {
> 	case USE_NUMERIC:
> 		result = Numeric_doit(a1, a2, a3);  break;
> 		result = Numarray_doit(a1, a2, a3);  break;
> 		result = Sequence_doit(a1, a2, a3);  break;
> }
> One last thing:  I think it would be useful to be able to drive the code
> into sequence mode with arrays.  This would enable easy benchmarking of
> the performance improvement.
> > (explicit safe conversion between Numeric and numarray is possible
> > if really needed).

Yeah, when I wrote 'if really needed', I was hoping to shift the
responsibility of coercion (or conversion) to the Python programmer (my
lazy side telling me that it can be done in pure Python).

You talked me into doing it in C :-)

Regards -- Gerard

More information about the Numpy-discussion mailing list