[Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part) (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Jun 28 19:11:25 EDT 2018


Baptiste Carvello wrote:

x=0; [x:=x+i for i in range(5)] what would be a non-cryptic alternative to the above example?

Personally I wouldn't insist on trying to do it with a comprehension at all, but if forced to come up with a readable syntax for that, it would probably be something like

[x for i in range(5) letting x = x + 1 given x = 0]

-- Greg



More information about the Python-Dev mailing list