
Personally, I'd still like to go back to := creating a statement-local name, one that won't leak out of ANY statement. But the tide was against that one, so I gave up on it.
yes. I have some probably tangential to bad arguments but I'm going to make them anyways, because I think := makes the most sense along with SLNB. first, := vs post-hoc (e.g. where or given) base case: [ x for x in range(1) ] while obvious to all of us, reading left to right does not yield what x is till later. [ (x, y) for x in range(1) for y in range(1) ] doubly so. If x or y were defined above, it would not be clear until the right end if what contex they had. [ (x, y) for x in range(n) given y = f(n) ] i dont know what's the iterator till after 'for' [ (x, y:=f(n) for x in range(n) ] At a minimum, I learn immediately that y is not the iterator. Slightly less cognitive load. it's not that one is better, or that either is unfamiliar, it's about having to hold a "promise" in my working memory, vs getting an immediate assignment earlier. (it's a metric!) now my silly argument. ":" is like a "when" operator. if y==x:
ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/