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

Stéfan van der Walt stefan at sun.ac.za
Sun Feb 14 15:58:16 EST 2010


On 14 February 2010 22:13, Pierre GM <pgmdevlist at gmail.com> wrote:
> On Feb 14, 2010, at 9:27 AM, Stéfan van der Walt wrote:
>> On 14 February 2010 14:54, Pierre GM <pgmdevlist at gmail.com> wrote:
>>> This backwards-incompatibility bugs me. Why don't we set dtype=None as the default for ndfromtxt & mafromtxt and tell people to use these functions instead (I'm pretty sure nobody knew they existed, so we can break them without upsetting anyone)(of course, there's gonna be a counterexample as soon as I post that).
>>
>> If `ndfromtxt' does the same as genfromtxt, why do we have it in the
>> main numpy namespace?
>
> Because it uses a slightly different set of defaults, so it's not exactly the same.

Here is the content of ndfromtxt:

    kwargs['usemask'] = False
    return genfromtxt(fname, **kwargs)

Here is the signature of genfromtxt:

np.genfromtxt(fname, dtype=<type 'float'>, comments='#',
delimiter=None, skiprows=0, skip_header=0, skip_footer=0,
converters=None, missing='', missing_values=None, filling_values=None,
usecols=None, names=None, excludelist=None, deletechars=None,
autostrip=False, case_sensitive=True, defaultfmt='f%i', unpack=None,
usemask=False, loose=True, invalid_raise=True)

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?

Regards
Stéfan



More information about the NumPy-Discussion mailing list