On Thu, Aug 29, 2013 at 9:39 AM, Benjamin Root wrote:
>
>
> On Thu, Aug 29, 2013 at 8:04 AM, Robert Kern wrote:
>
>> On Thu, Aug 29, 2013 at 12:00 PM, Martin Luethi
>> wrote:
>> >
>> > Dear all,
>> >
>> > After some surprise, I noticed an inconsistency while adding array
>> > slices:
>> >
>> > >
On Thu, Aug 29, 2013 at 8:04 AM, Robert Kern wrote:
> On Thu, Aug 29, 2013 at 12:00 PM, Martin Luethi
> wrote:
> >
> > Dear all,
> >
> > After some surprise, I noticed an inconsistency while adding array
> > slices:
> >
> > > a = np.arange(5)
> > > a[1:] = a[1:] + a[:-1]
> > > a
> > array([0, 1,
On Thu, Aug 29, 2013 at 12:00 PM, Martin Luethi
wrote:
>
> Dear all,
>
> After some surprise, I noticed an inconsistency while adding array
> slices:
>
> > a = np.arange(5)
> > a[1:] = a[1:] + a[:-1]
> > a
> array([0, 1, 3, 5, 7])
>
> versus inplace
>
> > a = np.arange(5)
> > a[1:] += a[:-1]
> > a
Dear all,
After some surprise, I noticed an inconsistency while adding array
slices:
> a = np.arange(5)
> a[1:] = a[1:] + a[:-1]
> a
array([0, 1, 3, 5, 7])
versus inplace
> a = np.arange(5)
> a[1:] += a[:-1]
> a
array([ 0, 1, 3, 6, 10])
My suspicition is that the second variant does not cre