Hi, > > This can lead to surprising bugs in code that either explicitly > > expects it to behave like python's max() or implicitly expects that by > > doing "from numpy import max".
my solution is to never use numpy.max. For arrays, I always use the method call (somearray.max()). For everything else the builtin. > I don't think we can reasonably change that in a 1.0 release, but I'm > all in favour of removing numpy.max in 1.1. Shadowing builtins is a > bad idea. The same goes for numpy.sum, which, at the least, should be > modified so that the function signatures are compatible: > numpy.sum(x, axis=None, dtype=None, out=None) > vs. > sum(sequence, start=0) +1 from me. Real world example where the shadowing made my code not work: >>> l = [[1, 2], [5, 6, 7], [9]] >>> l2 = sum(l, []) builtin result: l2 == [1, 2, 5, 6, 7, 9] numpy.sum result: exception... My suggestion for this would be to remove all shadowing in favor of array methods. Though I am aware this would break *lots* of "legacy" code. cu, Johannes _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
