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

Ville M. Vainio vivainio@gmail....
Thu Sep 6 01:34:56 CDT 2007


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

> On 9/5/07, ipython-svndiff@scipy.org <ipython-svndiff@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