logo       

RE: Empty arrays strange behaviour: msg#00054

python.numeric.general

Subject: RE: Empty arrays strange behaviour




-----Original Message-----
From: Todd Miller [mailto:jmiller@xxxxxxxxx]
Sent: Wed 18-Aug-04 13:46
To: Nadav Horesh
Cc: numpy-discussion
Subject: Re: [Numpy-discussion] Empty arrays strange behaviour
On Wed, 2004-08-18 at 07:36, Nadav Horesh wrote:
> >>> a = arange(20, shape=(4,5))
> >>> a
> array([[ 0, 1, 2, 3, 4],
> [ 5, 6, 7, 8, 9],
> [10, 11, 12, 13, 14],
> [15, 16, 17, 18, 19]])
> >>> a[2:4,5:7] # Shouldn't it raise index error?
> array([])

I wasn't sure about this, but what we're doing is faithful to what
Numeric does.

> >>> a[2:4, 5:7].iscontiguous()
> 0 # ????

Likewise here.

> >>> a[2:4, 5:7].copy().iscontiguous()
> 0 # ????

We're not compatible here.

> Shouldn't iscontiguous method of empty arrays and array.copy() return 1?

I'd say we should go with compatibility.

Todd



It isn't a major flaw, so compatibility is OK.
I got to this issue since I had a bug. If there was an option to get an
IndexError exception it would ease the debugging.

Thank you,
Nadav.


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise