[Numpy-discussion] RecArray.tolist() suggestion

Paul Barrett barrett at stsci.edu
Fri Jul 16 11:49:01 CDT 2004

Russell E Owen wrote:

>> A Divendres 16 Juliol 2004 02:21, Colin J. Williams va escriure:
>>>  To allow for multi-word column names, assignment could replace a space
>>>  by an underscore
>>>  and, in retrieval, the reverse could be done - ie. underscore would be
>>>  banned for a column name.
>> That's not so easy. What about other chars like '/&%@$()' that cannot be
>> part of python names? Finding a biunivocal map between them and allowed
>> chars would be difficult (if possible at all). Besides, the resulting
>> colnames might become a real mess.
> Personally, I think the idea of allowing access to fields via 
> attributes is fatally flawed. The problems raised (non-obvious mapping 
> between field names with special characters and allowable attribute 
> names and also the collision with existing instance variable and 
> method names) clearly show it would be forced and non-pythonic.


It also make it difficult to do the following:

a = item[:10, ('age', 'surname', 'firstname')]

where field (or column) 1 is 'firstname, field 2 is 'surname', and field 
10 is 'age'.

 -- Paul

Paul Barrett, PhD      Space Telescope Science Institute
Phone: 410-338-4475    ESS/Science Software Branch
FAX:   410-338-4767    Baltimore, MD 21218

More information about the Numpy-discussion mailing list