void () { doTestByText( """ def foo(): if any((comment := line).startswith('#') for line in lines): print("First comment:", comment) else: print("There are no comments") if all((nonblank := line).strip() == '' for line in lines): print("All lines are blank") else: print("First non-blank line:", nonblank) def bar(): [(comment := line).startswith('#') for line in lines] print(<warning descr="Local variable 'comment' might be referenced before assignment">comment</warning>) def baz(): while (line := input()) and any((first_digit := c).isdigit() for c in line): print(line, first_digit) def more(): if (x := True) or (y := 'spam'): print(<warning descr="Local variable 'y' might be referenced before assignment">y</warning>) """ ); }