On 10 May 2018 at 17:38, Ethan Furman
On 05/10/2018 09:29 AM, M.-A. Lemburg wrote:
On 10.05.2018 15:57, Guido van Rossum wrote:
On Thu, May 10, 2018 at 5:04 AM, M.-A. Lemburg wrote:
To a (former Pascal) programmer, a := 1 doesn't read like an operator. It's an assignment expression. If embedded expressions is where Python is heading, it should be made very clear where the embedded expression starts and where it ends on a line.
The rules we've arrived at are about as straightforward as it gets: the RHS of `:=` ends at the nearest comma or close parenthesis/bracket/brace.
That may be easy for a computer to parse, but it's not for a programmer. It would be better to contain such expressions inside a safe container which is clearly visible to a human eye.
ohoh = a := (1, 2, 3), 4, a * 2
I have no problem reading that.
vs.
aha = ((a := (1, 2, 3)), 4, a * 2)
The extra parens are unneeded line noise (at least for me).
I found the version with extra parens *harder* to read. Although I will admit neither is particularly easy to read (not surprising as it's an artificial example intended to prove a point, not a real world use case) and in practice I'd write a = 1, 2, 3 ohoh = a, 4, a * 2 Look ma, no parens! Paul