On 03/26/2012 12:59 PM, anatoly techtonik wrote:
On Sun, Mar 25, 2012 at 5:15 PM, Calvin Spealman
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.
Slightly off topic: And that's why I stopped to write "f() if g()" in Ruby and use the more verbose "if g(); f(); end" there. At first it looks like a nice small syntax, but then it turns out to severely hurt readability. I even found code like this once: begin # quite some lines of code rescue # more code end unless something.nil? Yes, the whole block is actually conditional. I think syntax, that requires you to update already parsed code is bad.