Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Christopher Barker
Tim Hochberg wrote: >> That's what I'd expect, but what if you start with a (0,) array: >> >>> a = N.array([]).sum(); a.shape; a.size; a >> () >> 1 >> 0 >> >> where did that zero come from? >> > More or less from: > > >>> numpy.add.identity > 0 I'm not totally sure, but I think I'd r

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Charles R Harris
On 8/31/06, Christopher Barker <[EMAIL PROTECTED]> wrote: Fernando Perez wrote:> In [8]: N.array(3).shape> Out[8]: ()> In [11]: N.array([]).shape> Out[11]: (0,)> I guess my only remaining question is: what is the difference between> outputs #8 and #11 above?  Is an empty shape tuple == array scalar

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Tim Hochberg
Christopher Barker wrote: > Fernando Perez wrote: > >> In [8]: N.array(3).shape >> Out[8]: () >> > > >> In [11]: N.array([]).shape >> Out[11]: (0,) >> > > >> I guess my only remaining question is: what is the difference between >> outputs #8 and #11 above? Is an empty shape tupl

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Christopher Barker
Fernando Perez wrote: > In [8]: N.array(3).shape > Out[8]: () > In [11]: N.array([]).shape > Out[11]: (0,) > I guess my only remaining question is: what is the difference between > outputs #8 and #11 above? Is an empty shape tuple == array scalar, > while a (0,) shape indicates a one-dimensional

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Charles R Harris
On 8/31/06, Fernando Perez <[EMAIL PROTECTED]> wrote: On 8/31/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:> What about>> N.array(3).size>> N.array([3]).size>> N.array ([3,3]).size>> Essentially, the [] is being treated as an object when you explicitly> ask for an object array in exactly the same

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Fernando Perez
On 8/31/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > What about > > N.array(3).size > > N.array([3]).size > > N.array([3,3]).size > > Essentially, the [] is being treated as an object when you explicitly > ask for an object array in exactly the same way as 3 is being treated as > a number in t

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-31 Thread Travis Oliphant
Fernando Perez wrote: > On 8/30/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > > >> The current behaviour makes sense, but is maybe not consistent: >> >> N.array([],dtype=object).size == 1 >> N.array([[],[]],dtype=object).size == 2 >> > > Yes, including one more term in this check: >

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-30 Thread Fernando Perez
On 8/30/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > The current behaviour makes sense, but is maybe not consistent: > > N.array([],dtype=object).size == 1 > N.array([[],[]],dtype=object).size == 2 Yes, including one more term in this check: In [5]: N.array([],dtype=object).size Out[5]:

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-30 Thread Stefan van der Walt
On Tue, Aug 29, 2006 at 10:49:58AM -0600, Travis Oliphant wrote: > Matt Knox wrote: > > is the following behaviour expected? or is this a bug with > > numpy.object_ ? I'm using numpy 1.0b1 > > > > >>> print numpy.array([],numpy.float64).size > > 0 > > > > >>> print numpy.array([],numpy.object_

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-29 Thread Travis Oliphant
Matt Knox wrote: > is the following behaviour expected? or is this a bug with > numpy.object_ ? I'm using numpy 1.0b1 > > >>> print numpy.array([],numpy.float64).size > 0 > > >>> print numpy.array([],numpy.object_).size > 1 > > Should the size of an array initialized from an empty list not alw

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-29 Thread Matt Knox
# is the following behaviour expected? or is this a bug with numpy.object_  ?  I'm using numpy 1.0b1#  # >>> print numpy.array([],numpy.float64).size# 0## >>> print numpy.array([],numpy.object_).size# 1## Should the size of an array initialized from an empty list not always be 1 ? or am I just cr

[Numpy-discussion] possible bug with numpy.object_

2006-08-29 Thread Matt Knox
is the following behaviour expected? or is this a bug with numpy.object_  ?  I'm using numpy 1.0b1   >>> print numpy.array([],numpy.float64).size0 >>> print numpy.array([],numpy.object_).size1 Should the size of an array initialized from an empty list not always be 1 ? or am I just crazy?   Thank