From: Benjamin Peterson Date: Sun, 10 May 2009 14:16:47 +0000 (+0000) Subject: use isinstance X-Git-Tag: v2.7a1~1216 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e1577fb20f662ad0565455f8d74366495c1d424b;p=python use isinstance --- diff --git a/Lib/dis.py b/Lib/dis.py index e60e702036..edc210fbcf 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -19,7 +19,7 @@ def dis(x=None): if x is None: distb() return - if type(x) is types.InstanceType: + if isinstance(x, types.InstanceType): x = x.__class__ if hasattr(x, 'im_func'): x = x.im_func @@ -29,10 +29,10 @@ def dis(x=None): items = x.__dict__.items() items.sort() for name, x1 in items: - if type(x1) in (types.MethodType, - types.FunctionType, - types.CodeType, - types.ClassType): + if isinstance(x1, (types.MethodType, + types.FunctionType, + types.CodeType, + types.ClassType)): print "Disassembly of %s:" % name try: dis(x1)