cf.AncillaryVariables.setattr

AncillaryVariables.setattr(attr, value)[source]

Set a named attribute on each element of the list.

fl.setattr(attr, value) is equivalent to for f in fl: f.attr = value.

Parameters :
attr : str

The attribute’s name.

value :

The value to set each attribute.

Returns :

None

Examples

>>> fl.setattr('foo', -99)
>>> fl.getattr('foo')
[-99, -99]
>>> fl.setattr('foo', [1, 2])
>>> fl.getattr('foo')
[[1, 2], [1, 2]]

Previous topic

cf.AncillaryVariables.set_equals

Next topic

cf.AncillaryVariables.setdata

This Page