Re: [Numpy-discussion] Why is the truth value of ndarray not simply size0 ?

2009-09-13 Thread Robert
Robert wrote: Neil Martinsen-Burrell wrote: On 2009-09-07 07:11 , Robert wrote: Is there a reason why ndarray truth tests (except scalars) deviates from the convention of other Python iterables list,array.array,str,dict,... ? Furthermore there is a surprising strange exception for arrays

Re: [Numpy-discussion] Why is the truth value of ndarray not simply size0 ?

2009-09-13 Thread Alan G Isaac
On 9/13/2009 7:46 AM, Robert wrote: 2 ways seem to be consistently Pythonic and logical: size 0; or any(a) (*); and the later option may be more 'numerical'. Well, *there's* the problem. As a user I have felt more than once that a length based test, like other containers, would be natural, so

Re: [Numpy-discussion] Why is the truth value of ndarray not simply size0 ?

2009-09-13 Thread josef . pktd
On Sun, Sep 13, 2009 at 9:05 AM, Alan G Isaac ais...@american.edu wrote: On 9/13/2009 7:46 AM, Robert wrote: 2 ways seem to be consistently Pythonic and logical: size 0; or any(a) (*); and the later option may be more 'numerical'. Well, *there's* the problem. As a user I have felt more than

Re: [Numpy-discussion] Why is the truth value of ndarray not simply size0 ?

2009-09-13 Thread Robert Kern
On Sun, Sep 13, 2009 at 05:30, Robert kxrobe...@googlemail.com wrote: Neil Martinsen-Burrell wrote: On 2009-09-07 07:11 , Robert wrote: Is there a reason why ndarray truth tests (except scalars) deviates from the convention of other Python iterables list,array.array,str,dict,... ?

[Numpy-discussion] Why is the truth value of ndarray not simply size0 ?

2009-09-07 Thread Robert
Is there a reason why ndarray truth tests (except scalars) deviates from the convention of other Python iterables list,array.array,str,dict,... ? Furthermore there is a surprising strange exception for arrays with size 1 (!= scalars). I often run into exceptions and unexpected bahavior like

Re: [Numpy-discussion] Why is the truth value of ndarray not simply size0 ?

2009-09-07 Thread Neil Martinsen-Burrell
On 2009-09-07 07:11 , Robert wrote: Is there a reason why ndarray truth tests (except scalars) deviates from the convention of other Python iterables list,array.array,str,dict,... ? Furthermore there is a surprising strange exception for arrays with size 1 (!= scalars). Historically,