20 Feb
2014
20 Feb
'14
6:23 a.m.
Chris Angelico wrote:
On Thu, Feb 20, 2014 at 2:13 PM, Greg Ewing
wrote: things[i] except IndexError if None
and you have even half your wits about you, then you'll notice that something doesn't make sense when you get to the 'if'.
Actually, you have to keep going to see if you hit an 'else', because "IndexError if None else something_else" is the same as "something_else".
For sanity, parentheses should probably be required for that interpretation: things[i] except (value if cond else other_value) if IndexError -- Greg