Permalink
Browse files

Neater code using getattr, as suggested by MinRK.

  • Loading branch information...
1 parent 0437a1f commit 27bb014f638f9836b16366a0b535a13a218d24dd @takluyver committed May 17, 2011
Showing with 2 additions and 4 deletions.
  1. +2 −4 IPython/core/oinspect.py
@@ -662,10 +662,8 @@ def info(self, obj, oname='', formatter=None, info=None, detail_level=0):
# from its __call__ method.
if inspect.isclass(obj):
- try:
- callable_obj = obj.__init__
- except AttributeError:
- callable_obj = None
+ # Old-style classes need not have an __init__
+ callable_obj = getattr(obj, "__init__", None)
elif callable(obj):
callable_obj = obj
else:

0 comments on commit 27bb014

Please sign in to comment.