Re: [Numpy-discussion] truthiness of object arrays

2014-11-13 Thread Alan G Isaac
On 11/13/2014 1:32 PM, Nathaniel Smith wrote: > I think you're being misled by buggy exception handling weirdness, > where the ValueError raised by calling __bool__ is getting delayed, > and then pre-empting the AttributeError that should be generated by > the call to __nonzero__. Aha! Thanks. _

Re: [Numpy-discussion] truthiness of object arrays

2014-11-13 Thread Nathaniel Smith
On Thu, Nov 13, 2014 at 1:24 PM, Alan G Isaac wrote: > On 11/13/2014 1:19 AM, Antony Lee wrote: >> "t.__bool__()" also returns True > > But t.__nonzero__() is being called in the `if` test. > The question is: is the difference between `__nonzero__` > and `__bool__` intentional. __nonzero__ and __

Re: [Numpy-discussion] truthiness of object arrays

2014-11-13 Thread Antony Lee
Dunno, seems unlikely that something changed with Python 3.4.2... $ python --version Python 3.4.2 $ python -c 'import numpy as np; print(np.__version__); t = np.array(None); t[()] = np.array([None, None]); t.__bool__(); t.__nonzero__()' 1.9.0 Traceback (most recent call last): File "", line 1, in

Re: [Numpy-discussion] truthiness of object arrays

2014-11-13 Thread Alan G Isaac
On 11/13/2014 12:37 PM, Antony Lee wrote: > On Python3, __nonzero__ is never defined (always raises an AttributeError), > even after calling __bool__. The example I posted was Python 3.4.1 with numpy 1.9.0. fwiw, Alan Isaac Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600

Re: [Numpy-discussion] truthiness of object arrays

2014-11-13 Thread Antony Lee
On Python3, __nonzero__ is never defined (always raises an AttributeError), even after calling __bool__. 2014-11-13 5:24 GMT-08:00 Alan G Isaac : > On 11/13/2014 1:19 AM, Antony Lee wrote: > > "t.__bool__()" also returns True > > > But t.__nonzero__() is being called in the `if` test. > The quest

Re: [Numpy-discussion] #2522 numpy.diff fails on unsigned integers

2014-11-13 Thread Jaime Fernández del Río
On Wed, Nov 12, 2014 at 11:10 PM, Sebastian wrote: > On 2014-11-04 19:44, Charles R Harris wrote: > > On Tue, Nov 4, 2014 at 11:19 AM, Sebastian wrote: > > > >> On 2014-11-04 15:06, Todd wrote: > >>> On Tue, Nov 4, 2014 at 2:50 PM, Sebastian Wagner >> > >>> > wrote: > >>>

Re: [Numpy-discussion] #2522 numpy.diff fails on unsigned integers

2014-11-13 Thread Todd
On Thu, Nov 13, 2014 at 8:10 AM, Sebastian wrote: > On 2014-11-04 19:44, Charles R Harris wrote: > > On Tue, Nov 4, 2014 at 11:19 AM, Sebastian wrote: > > > >> On 2014-11-04 15:06, Todd wrote: > >>> On Tue, Nov 4, 2014 at 2:50 PM, Sebastian Wagner >> > >>> > wrote: > >>>

Re: [Numpy-discussion] truthiness of object arrays

2014-11-13 Thread Sebastian Berg
On Do, 2014-11-13 at 08:24 -0500, Alan G Isaac wrote: > On 11/13/2014 1:19 AM, Antony Lee wrote: > > "t.__bool__()" also returns True > > > But t.__nonzero__() is being called in the `if` test. > The question is: is the difference between `__nonzero__` > and `__bool__` intentional. > > By the wa

Re: [Numpy-discussion] truthiness of object arrays

2014-11-13 Thread Alan G Isaac
On 11/13/2014 1:19 AM, Antony Lee wrote: > "t.__bool__()" also returns True But t.__nonzero__() is being called in the `if` test. The question is: is the difference between `__nonzero__` and `__bool__` intentional. By the way, there has been a change in behavior. For example, in 1.7.1 if you cal

Re: [Numpy-discussion] truthiness of object arrays

2014-11-13 Thread Sebastian Berg
On Mi, 2014-11-12 at 22:19 -0800, Antony Lee wrote: > I know you can't in general, but this was in a context where I knew > the array contained a single element, which "works" (it checks the > truthiness of the contained element). Of course I didn't consider the > case where the element contained

Re: [Numpy-discussion] Subscribing to mailinglist not possible / sites down

2014-11-13 Thread Robert Kern
Thanks, they have been restored. You can email me directly next time, since if those sites are down, so is the mailing list, most likely. On Wed, Nov 12, 2014 at 10:30 AM, Stefan Otte wrote: > Hey *, > > The websites to subscribe to the numpy/scipy mailinglists seem to be down: > > - http://mail.