[pypy-issue] [issue1539] numpypy inplace operations

mikefc tracker at bugs.pypy.org
Tue Jul 16 06:38:16 CEST 2013


New submission from mikefc <coolbutuseless at gmail.com>:

Under cpython/numpy, an inplace operation on an array uses the same memory.

Under numpypy, new memory is allocated for the result.

This seems to be the case for: += -= *= /=
#----------------------------------------------------------
# code code code code code
#----------------------------------------------------------
try:
    import numpy as np
except:
    import numpypy as np

a = np.array([1,2,3], dtype='f8')
start_address = a.__array_interface__['data'][0]
a *= 3
assert(a.__array_interface__['data'][0] == start_address)

----------
messages: 5933
nosy: mikefc, pypy-issue
priority: bug
status: unread
title: numpypy inplace operations

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1539>
________________________________________


More information about the pypy-issue mailing list