On Wed, May 28, 2008 at 3:34 PM, Charles R Harris >> I wonder if this is something that ought to be looked at for all >> functions with an "out" parameter? ndarray.compress also had problems >> with array type mismatch (#789); I can't imagine that it's safe to >> assume only these two functions were doing it incorrectly. (Unless of >> course somebody has recently looked at all of them) > > I think that is an excellent idea! A good start would be to list all the > functions with the out parameter and then write some tests. The current > behavior is inconsistent and we not only need to specify the behavior, but > fix all the places that don't follow the rules.
Here's a list of things in numpy that have an 'out' argument (and their arguments); I think I eliminated all the duplicated items (that are imported from a subpackage into one of the main packages, for example). There's stuff that's missing, probably; I think the C-implemented functions don't have argument lists programmatically available so I may parse their docstrings or something, but this is a start. numpy.all ['a', 'axis', 'out'] numpy.alltrue ['a', 'axis', 'out'] numpy.amax ['a', 'axis', 'out'] numpy.amin ['a', 'axis', 'out'] numpy.any ['a', 'axis', 'out'] numpy.around ['a', 'decimals', 'out'] numpy.choose ['a', 'choices', 'out', 'mode'] numpy.clip ['a', 'a_min', 'a_max', 'out'] numpy.compress ['condition', 'a', 'axis', 'out'] numpy.core.cumprod ['a', 'axis', 'dtype', 'out'] numpy.core.cumproduct ['a', 'axis', 'dtype', 'out'] numpy.core.cumsum ['a', 'axis', 'dtype', 'out'] numpy.core.defmatrix.matrix.all ['self', 'axis', 'out'] numpy.core.defmatrix.matrix.any ['self', 'axis', 'out'] numpy.core.fromnumeric.mean ['a', 'axis', 'dtype', 'out'] numpy.core.fromnumeric.prod ['a', 'axis', 'dtype', 'out'] numpy.core.fromnumeric.product ['a', 'axis', 'dtype', 'out'] numpy.core.fromnumeric.ptp ['a', 'axis', 'out'] numpy.core.fromnumeric.round_ ['a', 'decimals', 'out'] numpy.core.fromnumeric.sometrue ['a', 'axis', 'out'] numpy.core.fromnumeric.std ['a', 'axis', 'dtype', 'out', 'ddof'] numpy.core.fromnumeric.sum ['a', 'axis', 'dtype', 'out'] numpy.core.fromnumeric.take ['a', 'indices', 'axis', 'out', 'mode'] numpy.core.fromnumeric.trace ['a', 'offset', 'axis1', 'axis2', 'dtype', 'out'] numpy.core.fromnumeric.var ['a', 'axis', 'dtype', 'out', 'ddof'] numpy.lib.function_base.median ['a', 'axis', 'out', 'overwrite_input'] numpy.ma.choose ['indices', 't', 'out', 'mode'] numpy.ma.core.MaskedArray.compress ['self', 'condition', 'axis', 'out'] numpy.ma.core.max ['obj', 'axis', 'out'] numpy.ma.core.min ['array', 'axis', 'out'] numpy.ma.core.round_ ['a', 'decimals', 'out'] numpy.ma.extras.median ['a', 'axis', 'out', 'overwrite_input'] _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion