From 69de9805cc4e0c7bd8d3dee414fb41e15792ed6f Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Fri, 15 Sep 2006 19:48:27 +0000 Subject: Clean up info(ndarray) --- numpy/lib/utils.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'numpy/lib/utils.py') diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index db7c00db6..b6ee51b91 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -213,7 +213,6 @@ def _makenamedict(module='numpy'): thedict[modname] = moddict return thedict, dictlist - def info(object=None,maxwidth=76,output=sys.stdout,toplevel='numpy'): """Get help information for a function, class, or module. @@ -276,16 +275,16 @@ def info(object=None,maxwidth=76,output=sys.stdout,toplevel='numpy'): elif inspect.isclass(object): name = object.__name__ - if hasattr(object, '__init__'): - arguments = apply(inspect.formatargspec, inspect.getargspec(object.__init__.im_func)) - arglist = arguments.split(', ') - if len(arglist) > 1: - arglist[1] = "("+arglist[1] - arguments = ", ".join(arglist[1:]) - else: - arguments = "()" - else: - arguments = "()" + arguments = "()" + try: + if hasattr(object, '__init__'): + arguments = apply(inspect.formatargspec, inspect.getargspec(object.__init__.im_func)) + arglist = arguments.split(', ') + if len(arglist) > 1: + arglist[1] = "("+arglist[1] + arguments = ", ".join(arglist[1:]) + except: + pass if len(name+arguments) > maxwidth: argstr = _split_line(name, arguments, maxwidth) -- cgit v1.2.1