[Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)
Charles R Harris
charlesr.harris at gmail.com
Fri Jul 29 09:28:37 EDT 2011
On Fri, Jul 29, 2011 at 4:12 AM, Hans Meine <meine at informatik.uni-hamburg.de
> wrote:
> Am Freitag, 29. Juli 2011, 11:31:24 schrieb Hans Meine:
> > Am Donnerstag, 28. Juli 2011, 17:42:38 schrieb Matthew Brett:
> > > Was there a particular case you ran into where this was a problem?
> > [...]
> > Basically, the problem arose because our ndarray subclass does not
> support
> > zero-rank-instances fully. (And previously, there was no need for that.)
>
> I just reproduced the problem, it was this exception:
>
> /home/hmeine/new_numpy/lib64/python2.6/site-packages/vigra/arraytypes.pyc
> in
> reshape(self, shape, order)
> 587
> 588 def reshape(self, shape, order='C'):
> --> 589 res = numpy.ndarray.reshape(self, shape, order)
> 590 res.axistags = AxisTags(res.ndim)
> 591 return res
>
> TypeError: an integer is required
>
> The problem is that 'self' has become a zero-rank array, and those cannot
> be
> reshaped in order to add singleton dimensions anymore. IOW, if you
> implement
> sth. like broadcasting, this is made much harder.
>
>
What is self and shape in this example?
Out of curiosity, if you don't support all the ndarray operations, why are
you subclassing ndarray?
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110729/6087af5c/attachment.html>
More information about the NumPy-Discussion
mailing list