Skip to content

Commit

Permalink
Neater code using getattr, as suggested by MinRK.
Browse files Browse the repository at this point in the history
  • Loading branch information
takluyver committed May 17, 2011
1 parent 0437a1f commit 27bb014
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions IPython/core/oinspect.py
Expand Up @@ -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:
Expand Down

0 comments on commit 27bb014

Please sign in to comment.