OKB (not okblacke) wrote:
Hi. I'm trying to use NumPy's chararray class for an array of characters. I notice that when I try to set a chararray element to a space, it actually gets set to an empty string. I found some pages online indicating that the chararray strips trailing whitespace from its values.
You should ask numpy questions on the numpy mailing list. http://www.scipy.org/Mailing_Lists
I am really, really, hoping this is not a hard-coded, unalterable behavior. Is there a way to get NumPy chararray to include the characters I tell it to, without modificiation?
Sure. Just subclass chararray and redefine __getitem__ to do what you want. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list