I have this method:
def is_active(self):
if self.is_current_node():
return True
cur_children = self.get_children()
while cur_children is not None:
for child in cur_children:
if child.is_current_node():
return True
raise Exception(child.display_name)
cur_children = cur_children.get_children()
return False
I put this method together and I put the raise Exception(child.display_name)
to test out and "alert()" me to which child was being hit. The exception is never raised. You'd think that was because the function returned True
on the if child.is_current_node()
part. Well, if I replace the if
part with this:
for child in cur_children:
if child.is_current_node():
raise Exception(child.display_name)
It doesn't raise the exception still. If I do this however:
for child in cur_children:
raise Exception(child.display_name)
The exception is raised. I'm so confused. I'm sure this is something ridiculous but I was up till 2 and I can't think straight enough to wrap my tiny brain around this.