skrf.util.HomoList
- class skrf.util.HomoList(list_)[source]
A Homogeneous Sequence.
Provides a class for a list-like object which contains homogeneous values. Attributes of the values can be accessed through the attributes of HomoList. Searching is done like numpy arrays.
Initialized from a list of all the same type
>>> h = HomoDict([Foo(...), Foo(...)])
The individual values of h can be access in identical fashion to Lists.
>>> h[0]
Assuming that Foo has property prop and function func …
Access elements’ properties:
>>> h.prop
Access elements’ functions:
>>> h.func()
Searching:
>>> h[h.prop == value] >>> h[h.prop < value]
Multiple search:
>>> h[set(h.prop==value1) & set( h.prop2==value2)]
Combos:
>>> h[h.prop==value].func()
Methods
Raises ValueError if the value is not present. |