Re: [Numpy-discussion] isn't it a bug in array.fill()?

2008-08-29 Thread Charles R Harris
On Fri, Aug 29, 2008 at 3:03 PM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > Stéfan van der Walt wrote: > > At first, I also thought it might be more intuitive to return the > > output array, but then I realised that it would make it more difficult > > to realise that the operation is being performe

Re: [Numpy-discussion] isn't it a bug in array.fill()?

2008-08-29 Thread Alan G Isaac
Stéfan van der Walt wrote: > At first, I also thought it might be more intuitive to return the > output array, but then I realised that it would make it more difficult > to realise that the operation is being performed in-place. Maybe it > is good to remind programmers of what happens under the

Re: [Numpy-discussion] isn't it a bug in array.fill()?

2008-08-29 Thread Stéfan van der Walt
2008/8/29 Charles R Harris <[EMAIL PROTECTED]>: >> I like that idea. A lot of numpy functions return a reference to the >> modified array when the output array (out) is specified. > > Google up the various discussions of python sort to see why Guido doesn't > like that sort of thing. We've had that

Re: [Numpy-discussion] isn't it a bug in array.fill()?

2008-08-29 Thread Alan G Isaac
I suppose all the discussion on comp.lang.python about list methods (especially sort) is becoming relevant to this thread. Cheers, Alan Isaac ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-d

Re: [Numpy-discussion] isn't it a bug in array.fill()?

2008-08-29 Thread dmitrey
Keith Goodman wrote: > On Fri, Aug 29, 2008 at 10:51 AM, Keith Goodman <[EMAIL PROTECTED]> wrote: > >> On Fri, Aug 29, 2008 at 10:42 AM, dmitrey <[EMAIL PROTECTED]> wrote: >> >>> Keith Goodman wrote: >>> Yeah, I do stuff like that too. fill works in place so it returns None. >>>

Re: [Numpy-discussion] isn't it a bug in array.fill()?

2008-08-29 Thread Charles R Harris
On Fri, Aug 29, 2008 at 11:51 AM, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Fri, Aug 29, 2008 at 10:42 AM, dmitrey <[EMAIL PROTECTED]> > wrote: > > > > Keith Goodman wrote: > >> Yeah, I do stuff like that too. fill works in place so it returns None. > >> > >> > x = np.array([1,2]) >

Re: [Numpy-discussion] isn't it a bug in array.fill()?

2008-08-29 Thread Keith Goodman
On Fri, Aug 29, 2008 at 10:51 AM, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Fri, Aug 29, 2008 at 10:42 AM, dmitrey <[EMAIL PROTECTED]> wrote: >> >> Keith Goodman wrote: >>> Yeah, I do stuff like that too. fill works in place so it returns None. >>> >>> > x = np.array([1,2]) > x.fill(10)

Re: [Numpy-discussion] isn't it a bug in array.fill()?

2008-08-29 Thread Keith Goodman
On Fri, Aug 29, 2008 at 10:42 AM, dmitrey <[EMAIL PROTECTED]> wrote: > > Keith Goodman wrote: >> Yeah, I do stuff like that too. fill works in place so it returns None. >> >> x = np.array([1,2]) x.fill(10) x >>array([10, 10]) >> x = x.fill(10) # <-- Danger! print

Re: [Numpy-discussion] isn't it a bug in array.fill()?

2008-08-29 Thread dmitrey
Keith Goodman wrote: > Yeah, I do stuff like that too. fill works in place so it returns None. > > >>> x = np.array([1,2]) >>> x.fill(10) >>> x >>> >array([10, 10]) > >>> x = x.fill(10) # <-- Danger! >>> print x >>> > None > Since result "None" is never used it would be

Re: [Numpy-discussion] isn't it a bug in array.fill()?

2008-08-29 Thread Keith Goodman
On Fri, Aug 29, 2008 at 10:19 AM, dmitrey <[EMAIL PROTECTED]> wrote: > hi all, > isn't it a bug > (latest numpy from svn, as well as my older version) > > from numpy import array > print array((1,2,3)).fill(10) > None Yeah, I do stuff like that too. fill works in place so it returns None. >> x =

Re: [Numpy-discussion] isn't it a bug in array.fill()

2008-08-29 Thread dmitrey
sorry, it isn't a bug, it's my fault, fill() returns None and do in-place modification. D. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] isn't it a bug in array.fill()?

2008-08-29 Thread dmitrey
hi all, isn't it a bug (latest numpy from svn, as well as my older version) from numpy import array print array((1,2,3)).fill(10) None Regards, D. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/nu