On 11/29/2017 01:02 PM, Barry Warsaw wrote: > I don’t know whether I like any of this <wink> but I think a more > natural spelling would be: > > val = name.strip()[4:].upper() except (AttributeError, KeyError) as -1 > > which could devolve into: > > val = name.strip()[4:].upper() except KeyError as -1 > > or: > > val = name.strip()[4:].upper() except KeyError # Implicit `as None` Of all the proposed spellings for the idea, this one feels most "normal" to me, too (I'm -0 on the idea as a whole). > I would *not* add any spelling for an explicit bare-except equivalent. > You would have to write: > > val = name.strip()[4:].upper() except Exception as -1 Wouldn't that really need to be this instead, for a true 'except:' equivalence: val = name.strip()[4:].upper() except BaseException as -1 Tres. -- =================================================================== Tres Seaver +1 540-429-0999 tseaver at palladion.com Palladion Software "Excellence by Design" http://palladion.com
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