Discussing PEP 572
Discussing PEP 572
Posted Mar 16, 2018 10:59 UTC (Fri) by jag (subscriber, #3766)In reply to: Discussing PEP 572 by nybble41
Parent article: Discussing PEP 572
Out of these three:
stuff = [ (lambda y: [y, y])(f(x)) for x in range(5) ]
stuff = [ [(f(x) as y), y] for x in range(5) ]
stuff = [ f(x) as y in [y, y] for x in range(5) ]
I find the third line the easiest to read and understand, though the "in" bit should be allowed to be omitted:
#while (sock.read() as data in data):
while (sock.read() as data):
print("Received data:", data)
(Bike-shedding is fun!)
Posted Mar 22, 2018 17:13 UTC (Thu)
by welinder (guest, #4699)
[Link] (1 responses)
It's just a let-expression, so calling it "let" would be the obvious thing.
Posted Mar 22, 2018 17:59 UTC (Thu)
by anselm (subscriber, #2796)
[Link]
Obvious perhaps, but the people in charge of Python are understandably reluctant to introduce new keywords, which is always a problem for backwards compatibility.
Discussing PEP 572
same thing in other languages?
Discussing PEP 572