Barry Warsaw wrote: >> x = (if a then >> b >> elif c then >> d >> else >> e >> ) [...] > > I guess that's my point. To me, your latter is actually worse than > > if a: > x = b > elif c: > x = d > else: > x = e Can't see a difference as far as readability is concerned. But then, tastes differ. > I think the conditional stuff gets the most bang for the buck in > situations like: > > d[foo] = if a then b else c And I think similar holds for LCs and GEs. Unwinding a complex sequence of for and if clauses is certainly no fun unless one is really used to it. (Which doesn't take long, though.) But your example poses another question: Up until now, I had the impression that parentheses should be mandatory around a conditional expression. There's certainly no avoiding them in situations like (if x then 1 else 2) + 3. But what about unambiguous cases like your example line? -- Thomas
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4