Closed JoFrhwld closed 3 months ago
Actually, subclassing it with collections.abc.Sequence
could get us most of the way there. Just need to define:
def __getitem__(self, i):
return self.candidates[i]
def __len__(self):
return len(self.candidates)
The goal
My own user expectation is that if we have a
CandidateTracks
object calledtracks
, thentracks[0]
would return the first value intracks.candidates
. Similarly, I'd expectTo return an equivalent list to
How to do it
This will involve implementing the following dunder methods for
CandidateTracks
__getitem__
__iter__
__next__