On Tue, Apr 7, 2009 at 9:34 PM, Paganoni <noway / fakenullvoid.com> wrote:
> Hello, when writing stuff like that
Hmm I am speaking up againts very learned folks, so I might be wrong (
but that is true anyway ;).
Now I think that
begin
do_stuff
other_stuff
except
whatever
end
is easier to read than
begin
do_stuff
except
whatever
else
other_stuff
end
This however does not invalidate the very sound reasons Joel et altri
have given to move some code into the else clause.
What to do then? Maybe it all depends on the context (thank you Andy;)?
If you are catching a very general exception e.g.
except
except StandardError
except Exception
it is probably indeed wise to chose the else for your "ordinary" code.
However if do_stuff might raise a very specific exception I would
prefer the "simpler"
begin
do_stuff
other_stuff
except SpecificException => se
whatever se
end
Just my micromoney.
Cheers
Robert
There are some people who begin the Zoo at the beginning, called
WAYIN, and walk as quickly as they can past every cage until they get
to the one called WAYOUT, but the nicest people go straight to the
animal they love the most, and stay there. ~ A.A. Milne (from
Winnie-the-Pooh)