Erin Sheldon wrote:
On 3/15/06, Travis Oliphant <oliphant@ee.byu.edu> wrote:
The dtype object does contain what you want. In fact. It's the fields attribute of the dtype object that is a dictionary accessed by field name. Thus, to see if a field is a valid field itdentifier,
if name in t.dtype.fields:
would work (well there is a slight problem in that -1 is a special key to the dictionary that returns a list of field names ordered by offset and so would work also), but if you now that name is already a string, then no problem.
Yes, I see, but I think you meant
if name in t.dtype.fields.keys():
Actually, you can use this with the dictionary itself (no need to get the keys...) name in t.dtype.fields is equivalent to name in t.dtype.fields.keys() -Travis