[Numpy-discussion] genloadtxt: dtype=None and unpack=True

Ryan May rmay31@gmail....
Thu Feb 12 10:36:04 CST 2009


On Wed, Feb 11, 2009 at 10:47 PM, Pierre GM <pgmdevlist@gmail.com> wrote:

>
> On Feb 11, 2009, at 11:38 PM, Ryan May wrote:
>
> > Pierre,
> >
> > I noticed that using dtype=None with a heterogeneous set of data,
> > trying to use unpack=True to get the columns into separate arrays
> > (instead of a structured array) doesn't work.  I've attached a patch
> > that, in the case of dtype=None, unpacks the fields in the final
> > array into a list of separate arrays.  Does this seem like a good
> > idea to you?
>
> Nope, as it breaks consistency: depending on some input parameters,
> you either get an array or a list. I think it's better to leave it as
> it is, maybe adding an extra line in the doc precising that
> unpack=True doesn't do anything for structured arrays.
>

Ah, I hadn't thought of that.  I was only thinking in terms of the behavior
of unpacking on return, not in the actual returned object.  You're right,
it's a bad idea.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090212/c54e5225/attachment.html 


More information about the Numpy-discussion mailing list