[Numpy-discussion] numarray.records - get/set item
haase at msg.ucsf.edu
Thu Dec 4 14:42:07 CST 2003
Is it maybe a good idea to add this to the definition of 'class Record'
"""Class for one single row."""
def __getitem__(self, fieldName):
def __setitem__(self, fieldName, value):
self.array.field(fieldName)[self.row] = value
I don't know about the implications if __delitem __ and so on are not
I just think it would look quite nice to say
myRecArr['mmm'] = 'hallo'
as opposed to
Actually I would even like
myRecArr.mmm = 'hallo'
This should be possible by defining __setattr__.
It would obviously only work for fieldnames that do not contain '.' or ' '
Any comments ?
More information about the Numpy-discussion