[issue43055] Inconsistent behaviour when using walrus operator with 'and'/'or'

2021-01-28 Thread Eric V. Smith
Eric V. Smith added the comment: I'm going to close this. The short circuit evaluation of and/or expressions is already documented, and this behavior follows directly from that. -- resolution: -> not a bug stage: -> resolved status: open -> closed

[issue43055] Inconsistent behaviour when using walrus operator with 'and'/'or'

2021-01-28 Thread Eric V. Smith
Eric V. Smith added the comment: I think this is pretty clearly the intended semantics. In your first example, what do you propose "print(x)" would produce? Consider: if False and (x:=input()) != '': pass else: print(x) We cannot change the semantics to now call input(), or any function

[issue43055] Inconsistent behaviour when using walrus operator with 'and'/'or'

2021-01-28 Thread Aman Anifer
New submission from Aman Anifer : Using the walrus operator (:=) alongside 'and'/'or' shows inconsistent behaviour which changes with the order of given conditions. For example: if(False and (x := 0)<1): print("Yes") else: print(x) Gives the error that 'NameError: name 'x' is not