[Python-ideas] Implied try blocks

Calvin Spealman ironfroggy at gmail.com
Mon Mar 26 14:38:09 CEST 2012

On Mon, Mar 26, 2012 at 6:59 AM, anatoly techtonik <techtonik at gmail.com> wrote:
> On Sun, Mar 25, 2012 at 5:15 PM, Calvin Spealman <ironfroggy at gmail.com> wrote:
>> r = some_single_statement()
>> except TypeError:
>>    print "oh no!"
>>    raise OhNoException()
>> else:
>>    p = prepare(r)
>>    print "I got", p
> -1, because.. When I reading this and encounter "except TypeError", I
> have to update the code that I've already read (the stuff in my head)
> to place it into exception handling block. That's a good anti-pattern
> for readability.

The idea i was hoping to pull off here is that every statement was,
implicitly, a try block and any exception raised by it could have
handlers associated, and a block that would only follow if it did not
raise an exception.

However, I never thought it was a great idea, but this is python-ideas
not python-good-ideas ;-)

Steven has already convinced me it was a bad idea from a maintenance standpoint.

> --
> anatoly t.

Read my blog! I depend on your acceptance of my opinion! I am interesting!
Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy

More information about the Python-ideas mailing list