Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-31 Thread Hans Meine
On Fri, Jul 29, 2011 at 4:12 AM, Hans Meine me...@informatik.uni-hamburg.de wrote: /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 =

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-31 Thread Hans Meine
Am 29.07.2011 um 17:07 schrieb Mark Wiebe: I dug a little bit into the relevant 1.5.x vs 1.6.x code, in the places I would most suspect a change, but couldn't find anything obvious. Thanks for having a look. This strengthens my suspicion that the behavior change was not intentional. Have a

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-31 Thread Hans Meine
Am 29.07.2011 um 20:23 schrieb Nathaniel Smith: Even so, surely this behavior should be consistent between base class ndarrays and subclasses? If returning 0d arrays is a good idea, then we should do it everywhere. If it's a bad idea, then we shouldn't do it at all...? Very well put. That's

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-31 Thread Charles R Harris
On Sun, Jul 31, 2011 at 12:50 AM, Hans Meine me...@informatik.uni-hamburg.de wrote: Am 29.07.2011 um 20:23 schrieb Nathaniel Smith: Even so, surely this behavior should be consistent between base class ndarrays and subclasses? If returning 0d arrays is a good idea, then we should do it

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-31 Thread eat
Hi, On Sun, Jul 31, 2011 at 7:36 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Jul 31, 2011 at 12:50 AM, Hans Meine me...@informatik.uni-hamburg.de wrote: Am 29.07.2011 um 20:23 schrieb Nathaniel Smith: Even so, surely this behavior should be consistent between base

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-29 Thread Hans Meine
Am Donnerstag, 28. Juli 2011, 17:42:38 schrieb Matthew Brett: If I understand you correctly, the problem is that, for 1.5.1: class Test(np.ndarray): pass type(np.min(Test((1, type 'numpy.float64' and for 1.6.0 (and current trunk): class Test(np.ndarray): pass

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-29 Thread Hans Meine
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.

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-29 Thread Charles R Harris
On Fri, Jul 29, 2011 at 4:12 AM, Hans Meine me...@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,

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-29 Thread Mark Wiebe
On Thu, Jul 28, 2011 at 9:58 AM, Hans Meine me...@informatik.uni-hamburg.de wrote: Hi again! Am Donnerstag, 21. Juli 2011, 16:56:21 schrieb Hans Meine: import numpy class Test(numpy.ndarray): pass a1 = numpy.ndarray((1,)) a2 = Test((1,)) assert type(a1.min()) ==

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-29 Thread Benjamin Root
On Fri, Jul 29, 2011 at 10:07 AM, Mark Wiebe mwwi...@gmail.com wrote: On Thu, Jul 28, 2011 at 9:58 AM, Hans Meine me...@informatik.uni-hamburg.de wrote: Hi again! Am Donnerstag, 21. Juli 2011, 16:56:21 schrieb Hans Meine: import numpy class Test(numpy.ndarray): pass a1 =

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-29 Thread Nathaniel Smith
On Jul 28, 2011 8:43 AM, Matthew Brett matthew.br...@gmail.com wrote: So, 1.6.0 is returning a zero-dimensional scalar of the given type, and 1.5.1 returns a python scalar. Zero dimensional scalars are designed to behave in a similar way to python scalars, so the change should be all but

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-28 Thread Hans Meine
Hi again! Am Donnerstag, 21. Juli 2011, 16:56:21 schrieb Hans Meine: import numpy class Test(numpy.ndarray): pass a1 = numpy.ndarray((1,)) a2 = Test((1,)) assert type(a1.min()) == type(a2.min()), \ %s != %s % (type(a1.min()), type(a2.min())) #

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-28 Thread Matthew Brett
Hi, On Thu, Jul 28, 2011 at 7:58 AM, Hans Meine me...@informatik.uni-hamburg.de wrote: Hi again! Am Donnerstag, 21. Juli 2011, 16:56:21 schrieb Hans Meine: import numpy class Test(numpy.ndarray):     pass a1 = numpy.ndarray((1,)) a2 = Test((1,)) assert type(a1.min()) ==

[Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-21 Thread Hans Meine
Hi, I have the same problem as Martin DRUON, who wrote 10 days ago: I have a problem with the ufunc return type of a numpy.ndarray derived class. In fact, I subclass a numpy.ndarray using the tutorial : http://docs.scipy.org/doc/numpy/user/basics.subclassing.html But, for example, if I