12 Feb
2014
12 Feb
'14
9:02 p.m.
Hi, Here's an idea that would help shortening code. Allow a ternary expression based on except, like so: first_entry = entries[0] except IndexError else None item = my_queue.get() except queue.Empty else None response_text = request('http://whatever.com').text except HttpError else "Can't access data" Aside from the fact that this would be a big grammar addition, a big problem here is the usage of the `else` keyword, that when used with except usually means "what would happen if there wasn't an exception" and here means the opposite. But I couldn't think of a nicer syntax. I realize that this is a big change and that most people would be opposed to this... But I guess I just wanted to share my idea :) Ram.