#NEWLINE# def comparison_type( logical_line ) : #NEWLINE# #INDENT# '\n    Object type comparisons should always use isinstance() instead of\n    comparing types directly.\n\n    Okay: if isinstance(obj, int):\n    E721: if type(obj) is type(1):\n\n    When checking if an object is a string, keep in mind that it might be a\n    unicode string too! In Python 2.3, str and unicode have a common base\n    class, basestring, so you can do:\n\n    Okay: if isinstance(obj, basestring):\n    Okay: if type(a1) is type(b1):\n    ' #NEWLINE# match = COMPARE_TYPE_REGEX . search ( logical_line ) #NEWLINE# if match : #NEWLINE# #INDENT# inst = match . group ( 3 ) #NEWLINE# if ( inst and isidentifier ( match ) and ( inst not in SINGLETONS ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# ( yield ( match . start ( 1 ) , "E721 do not compare types, use 'isinstance()'" ) )