Here is a bit of code that I'm trying to make more readable. It works, but the nested for loops and the try/if makes it a bit hard to understand at first glance what's going on.
Can someone give me suggestions on how I could possibly join the nested for loops or condense this code?
matcher = None
if re.match(_RE_OBJECT, nodes.replace(LQMN, '')):
matcher = alias
else:
for x in lister[0].conditions:
for y in x.codes:
try:
if y.id.split(',')[1] == condition:
matcher = x.codenames
except IndexError:
pass