I am wondering about the most idiomatic way of checking the index of a region within
Firstly, the following (idiomatic or not) doesn’t work, and I would like to ask why:
def index_within(thing, container): for i, t in enumerate(container): if t is thing: return i return -1 for r in view.sel(): print("the index of region r with view.sel() is:", index_within(r, view.sel())
Apart from that, how else would one check the index of a region in
view.sel(), except for replacing
== in the above?