B.3. NestedRecord objects

Each element of the nested record array is a NestedRecord, i.e. a Record with support for nested datatypes. As said before, we can do indexing as usual:


>>> print nra1[0]
(1, (0.5, 1.0), ('a1', 1j))
>>>
	  

Using NestedRecord objects is quite similar to using Record objects. To get the data of a field we use the field() method. As an argument to this method we pass a field name. Sub-field names can be passed in the way described for NestedRecArray.field(). The fields attribute is also present and works as it does in NestedRecArray.

Field data can be set with the setField() method. It takes two arguments, the field name and its value. Sub-field names can be passed as usual. Finally, the asRecord() method converts a nested record into a non-nested equivalent record.