|
Re: Empty arrays strange behaviour: msg#00058python.numeric.general
On Wed, 2004-08-18 at 11:42, Tim Hochberg wrote: > Todd Miller wrote: > > > [CHOP] > > >The key points for me are: > > > >1. The slice operation doesn't raise an exception even though it has > >"invalid" indexes. As Tim H. pointed out, those are standard Python > >semantics. > > > >2. The shape of the resultant array is the same. > > > >I don't know anything about the purpose of "zeros()" in this context. It > >looks inconsistent to me. > > > > > > > I believe it's to disambiguate the various possible arrays of total size > zero. I like the Numeric behaviour better here, although it's not a big > deal. In the following, both the size and type of the numarrays are > ambiguous from their repr(). This means that among other things > eval(repr(arg)) won't return arg even for nice short arrays (I realize > the numarray truncates the reprs of long arrays by default and I think > that's fine -- I imagine there's some way to disable it, but I haven't > looked for it yet). > > -tim > > >>> import Numeric as np > >>> np.zeros([0]) > zeros((0,), 'l') > >>> np.zeros([0,2]) > zeros((0, 2), 'l') > >>> import numarray as na > >>> na.zeros([0]) > array([]) > >>> na.zeros([0,2]) > array([]) > >>> na.arange(100) > > OK, I logged this on SF. Thanks for the explanation. Todd ------------------------------------------------------- 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> |
|---|---|---|
| Previous by Date: | Re: Re[2]: Empty arrays strange behaviour: 00058, Todd Miller |
|---|---|
| Next by Date: | Accessing a C library from numarray: 00058, Bruce Southey |
| Previous by Thread: | Re: Re[2]: Empty arrays strange behaviouri: 00058, Todd Miller |
| Next by Thread: | Accessing a C library from numarray: 00058, Bruce Southey |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |