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

Ville M. Vainio vivainio at gmail.com
Thu Sep 6 02:34:56 EDT 2007


On 9/6/07, Fernando Perez <fperez.net at gmail.com> wrote:

> 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

We really have no certainty what "obj" will be anymore (even though
it's typically a 2-tuple), so we can fall back to just rendering str
representation of the object if we get an unknown exception. I.e.
except does not signal an error situation. If this masked some
exception raised in str, it would be raised again on next line.

In short, this particular except was for necessity (duck typing),
rather than laziness :-).

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'



More information about the IPython-dev mailing list