[Numpy-discussion] Numeric.put bug

Lindy Lindstrom lindy at scripps.edu
Fri Oct 5 10:11:05 EDT 2001

Has anyone yet noted this?

The following code works in python1.5.2 (Numeric.__version__ == '11').
However, in python2.0 (with Numeric.__version__ == '17.1.1') and
python2.1 (with Numeric.__version__ == '20.0.0'), it doesn't work
coords[3][3] is mis-assigned. It happens at least on SGI and Sun. I've
seen anything in the change lists for 20.1 or 20.2 about such a bug.

#  bug.py
import Numeric

coords = Numeric.resize(Numeric.array(range(17*4)), (17,4))
print "before coords[3]: ", coords[3]

list = [3, 15]

takecoords = Numeric.take(coords, list)
print "takecoords:"
print takecoords

print "coords.iscontiguous: ", coords.iscontiguous()
Numeric.put(coords, list, takecoords)
print "after coords[3]: ", coords[3]

William M. Lindstrom, Jr., Ph.D.
Molecular Graphics Laboratory
Department of Molecular Biology, MB-5
The Scripps Research Institute
10550 North Torrey Pines Road
La Jolla, CA 92037-1000
Tel:        (858) 784-2055
Fax:        (858) 784-2860
E-mail:    lindy at scripps.edu

More information about the NumPy-Discussion mailing list