i have an array list, i find a point in the list i require and then take 3 values from that point right, however while this works perfect, i am worried due that if the value was the last value in the list it would error, instead i would want it to loop around to the start of the list again
for example if it picked z i would then want it to also pick a and b as well
this is my current code :
descriptor_position = bisect_left(orHashList, b32decode(descriptor_id,1)) #should be identiy list not HSDir_List #TODO - Add the other part of the list to it so it makes a circle
for i in range(0,3):
responsible_HSDirs.append(orHashList[descriptor_position+i])
return (map(lambda x: consensus.get_router_by_hash(x) ,responsible_HSDirs))
what function or library can i use that achieves this ?
Thanks