Looking for a little education on edu-sig. On one hand I am feeling like a big boy, having announced today on the vpython list that I think I have adequately accomplished the necessary fixes to the vpython C++ code to accomplish compatibility with the newly released numpy 1.0, and in a way that I think in the end (it was a round-about process for me) is straightforward and unlikely to introduce bugs into the existing stable codebase.
OTOH, I am learning there is some very basic Python I do not understand. Now having a vpython that runs against numpy, I am learning about some of the changes in the numpy Python API versus that of Numeric and numarray. One basic incompatibility is in that the older libraries did something to give a result in comparing 2 arrays that numpy backs away from - complaining about ambiguity. For example, in the vpython faces_heightfield.py demo there is a line: >>>normal[i] = vertex_map[tp] and norm( vertex_map[ tp ] ) which ran fine under Numeric and numarray, and now fails with a message: """ The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() """ For the purposes of the exercise assume that both "vertex_map[tp]" and "norm( vertex_map[ tp ]" each return one dimensional, 3 element numpy arrays. Not exactly true, but I think the result would be the same if it were. In the original code, what is the "and" doing, and in what way might the "any" or "all" built-ins be used to get the result intended by it? Art _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig