I've used list of lists [ [], [] ]
I've used list of tuples [ (), () ]
and I've used list of dictionaries [ {}, {} ]
Today I'm looking at list of instances [ <>, <> ]
I'm not sure how to traverse through the list elements' fields.
Here is python output (with carriage returns added for readability):
>>> import pulsectl
>>> pulse = pulsectl.Pulse('mserve') # 'mserve' is irrelvant
>>> pulse.sink_input_list()
[
<PulseSinkInputInfo at 7f3c2a188290 -
index=569L, mute=0, name=u'AudioStream'>,
<PulseSinkInputInfo at 7f3c2a1884d0 -
index=571L, mute=0, name=u'Simple DirectMedia Layer'>,
<PulseSinkInputInfo at 7f3c2a188b50 -
index=573L, mute=0, name=u'Simple DirectMedia Layer'>,
<PulseSinkInputInfo at 7f3c2a188fd0 -
index=575L, mute=0, name=u'Simple DirectMedia Layer'>
]
>>> print type(pulse.sink_input_list()[1])
<class 'pulsectl.pulsectl.PulseSinkInputInfo'>
I'm not sure how to traverse a list of classes. The -
to separate the class name and dictionary of fields is weird. The fact dictionary key/value pairs are separated by =
instead of :
is alien.
I searched to see if an answer to this was already posted and I didn't get any results. Ultimately I'd like to convert the list of classes into a list of dictionaries for normal processing.