[Numpy-discussion] rank-0 chararrays?

Francesc Alted falted at openlc.org
Tue Feb 18 09:54:08 EST 2003


A Dimarts 18 Febrer 2003 13:44, Todd Miller va escriure:
>  You are giving me interface angst...  :)

Well, I don't know exactly what do you mean with that, but I hope it would
be something not too bad ;)

>
> This was not always so,  be we made it work when we thought rank-0 had
> something to offer.  After some discussion on numpy-discussion-list,
>  rank-0 went out of vogue.

Mmmm, do you mean that rank-0 is being deprecated in numarray?

> Why exactly do you need rank-0?

Appart from supporting chararrays in PyTables, I'm using them as a buffer to
save homogeneous character standard lists and tuples, because it is very
easy to obtain a contiguous C buffer from it. However, if I have no
possibility to distinguish between "qqq" and ["qqq"] objects directly from
chararray instances obtained from them, I can't materialize them properly
when reading the objects from the persitent storage.

Perhaps using more metadata could solve the situation (for example, saving
the original shape of the object), but I wouldn't like to clutter
unnecessarily PyTables metadata space.

>
> >What can be done to achieve this?
>
> 1. Add a little special casing to chararray._charArrayToStringList() to
> handle rank-0.  I did this already in CVS.

Ok. For the moment I'll be using numarray CVS, although I don't know if next
version of numarray will be out before next PyTables release (planned in a
couple of weeks).

> 2. Debate whether or not to change chararray.array() to work as you've
> shown above.  Proceed from there.

Well, the fact is that I needed rank-0 only for the reason stated before.
But I'm not sure if this is reason enough to open such a debate.

Thanks!,

-- 
Francesc Alted




More information about the NumPy-Discussion mailing list