[Python-Dev] Slow down... (original) (raw)
Tim Peters tim.peters at gmail.com
Wed May 9 00:50:02 EDT 2018
- Previous message (by thread): [Python-Dev] Slow down...
- Next message (by thread): [Python-Dev] Slow down...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Steven D'Aprano <steve at pearwood.info>]
... If we could look forward to 2028, when we're running Python 3.14 or so (4.7 if you prefer), how many fantastic language features that we cannot bear to give up would we be missing out on?
This, for just one:
k = 6 if >!{myobj.meth(arg)[2]} elsenone 7 elsenan 8 else 5
Which is really annoying to write today, but would be much clearer with binding expressions:
if myobj is None:
k = 7
elif (t := myobj.meth) is None:
k = 7
elif (t := t(arg)) is None:
k = 7
elif (t := t[2]) is None:
k = 7
eiif math.isnan(t):
k = 8
elif t:
k = 6
else:
k = 5
The future is blindingly bright :-)
- Previous message (by thread): [Python-Dev] Slow down...
- Next message (by thread): [Python-Dev] Slow down...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]