[IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection
Thu Sep 6 01:13:03 CDT 2007
On Thu, Sep 06, 2007 at 12:06:43AM -0600, Fernando Perez wrote:
> On 9/5/07, firstname.lastname@example.org <email@example.com> wrote:
> > + try:
> > + ds = "Alias to the system command:\n %s" % obj
> > + except:
> > + ds = "Alias: " + str(obj)
> What is this bare 'except' clause trying to stop? Is it the
> IndexError from obj 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.
More information about the IPython-dev