[Numpy-discussion] dtype=None as default for np.genfromtxt ?

Pierre GM pgmdevlist@gmail....
Sun Feb 14 16:03:42 CST 2010


On Feb 14, 2010, at 3:58 PM, Stéfan van der Walt wrote:
> All ndfromtxt does is to force usemask to False (but usemask is False
> by default).  This isn't documented, nor is it reflected by the name.
> What am I missing?


http://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html#shortcut-functions

In my mind, np.genfromtxt is a generic function that can be complemented with shortcut functions. These shortcuts can use different defaults which trigger different behavior.
Here, ndfromtxt forces usemask to False, so you'll never have a MaskedArray (even if some entries are missing). It doesn't do more than that, true, but it's an example of shortcut.
 I was suggesting that we could use dtype=None as a default for ndfromtxt, which would address the issue raised in the ticket without breaking backward compatiblity (because nobody uses ndfromtxt anyway). Note that we already have recfromtxt that uses dtype=None by default, but it returns a recarray instead of a structured array.


More information about the NumPy-Discussion mailing list