On 12/06/2013 14:10, Nathaniel Smith wrote:
It looks like we've gotten a bit confused and need to untangle something. There's a PR to add new functions 'np.filled' and 'np.filled_like': https://github.com/numpy/numpy/pull/2875 And there was a discussion about this on the list back in January: http://thread.gmane.org/gmane.comp.python.numeric.general/52763
I think a reasonable summary of the opinions in the thread are: - This functionality is great, ... - ...but we can't call it 'np.filled' because there's also 'np.ma.filled' which does something else... - ...but there really aren't any better names... - ...so we should overload np.empty, like: 'np.empty(shape, fill=value)'
There where the additional proposal (mostly neglected on the original thread) to add the 'fill' optional parameter to the array constructor: np.ndarray(shape, fill=value) has an obvious meaning to me. I also don't really see why an np.empty() constructor exists, it seems to do the same thing that np.ndarray() does. However, I don't know if adding a np.ndarray_like() constructor would make much sense. Cheers, Daniele