[Python-ideas] except expression

Chris Angelico rosuav at gmail.com
Thu Feb 20 05:18:25 CET 2014


On Thu, Feb 20, 2014 at 2:13 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> 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".

ChrisA


More information about the Python-ideas mailing list