[Numpy-discussion] vacuum expansion of strings in record array

Les Schaffer schaffer at optonline.net
Sat Jun 4 11:59:05 EDT 2005


is this a feature or a bug? see snippet below, i would like the empty 
string to stay empty, not grow to an empty space from nothing.

thnx

les schaffer


code:

import numarray.records as rec

names = ['col1', 'col2']

d1 = [ ['', 'hello'], ['', 'world']]
d2 = [ ['hh', 'hello'], ['', 'world']]
print d1, d2

recarray1 = rec.array(d1, names=names)  # aligned=0,1 made no diff
recarray2 = rec.array(d2, names=names)  # aligned=0,1 made no diff
print recarray1
print recarray2


output:

[['', 'hello'], ['', 'world']] [['hh', 'hello'], ['', 'world']]
RecArray[
('', 'hello'),
('', 'world')
]
RecArray[
('hh', 'hello'),
(' ', 'world')

  ^
  |____ vacuum expansion
]





More information about the NumPy-Discussion mailing list