On Sat, Feb 22, 2014 at 1:07 PM, Victor Stinner <victor.stinner at gmail.com> wrote: > At the first read, I'm unable to understand this long expression. At > the second read, I'm still unable to see which instruction will be > executed first: lvl1[key] or lvl2[key]? > > The advantage of the current syntax is that the control flow is > obvious, from the top to the bottom: > > # start > try: > x = lvl1[key] # first instruction > except KeyError: > try: > x = lvl2[key] > except KeyError: > x = f(key) # latest instruction > # end That's why I'm strongly in favour of syntax variants that have evaluation order be equally obvious: left to right. Its notation may be uglier, but C's ternary operator does get this right, where Python's executes from the inside out. It's not a big deal when most of it is constants, but it can help a lot when the expressions nest. ChrisA
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