[Python-ideas] Re: SyntaxError: cannot use assignment expressions with attribute

2023-10-09 Thread Stephen J. Turnbull
Dom Grigonis writes: > Mistake, late night. I just meant to portray initialisation via > walrus inside statement, nothing more. It doesn’t work with while > loop. It *does* work with a while loop, just not that one. See below. The problem is that you're writing new code full of trash you don

[Python-ideas] Re: SyntaxError: cannot use assignment expressions with attribute

2023-10-09 Thread Dom Grigonis
I just want to note that this is just a gentle suggestion/observation, in case this wasn’t done yet. I am not pushing this. —— All good points, thank you. —— Why would this not be a good option? 1 extra line compared to walrus, but no DRY issue. with open(“fn") as f: while True: