[IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection

Gael Varoquaux gael.varoquaux at normalesup.org
Thu Sep 6 02:13:03 EDT 2007


On Thu, Sep 06, 2007 at 12:06:43AM -0600, Fernando Perez wrote:
> Hey,

> On 9/5/07, ipython-svndiff at scipy.org <ipython-svndiff at scipy.org> wrote:

> > +                try:
> > +                    ds = "Alias to the system command:\n  %s" % obj[1]
> > +                except:
> > +                    ds = "Alias: " + str(obj)

> What is this bare 'except' clause trying to stop?  Is it the
> IndexError from obj[1] or a possible error on str()?  Catch-all naked
> excepts should really be avoided except for a few occasions where they
> are there as last-resort measures to prevent a full crash.  They tend
> to mask the real intent of the code and hide possible unintended bugs.

That's interesting. Yesterday we were discussing with colleagues whether
to add an except statement in a bit of code we were adding to a large
Matlab framework (10K lines ore more). We didn't want that bit of code,
which was controlling an external instrument, to bring down the whole
experiment if communication was lost with the instrument.

However Matlab as no exception hierarchy that we know of, and no
"finally" clause, so we decided against the except, preferring to bring
down the experiment than to have a problem we could not diagnose.

Gaël



More information about the IPython-dev mailing list