(a, b)
return any([
        try_else_false(lambda _a, _b: str(_a) == str(_b)),
        try_else_false(lambda _a, _b: int(_a) == int(_b)),
        try_else_false(lambda _a, _b: float(_a) == float(_b))
    ])
exhaustive equality checking, originally to compare a sqlalchemy result object of various types to a csv string
    Note: Stringifying covers object cases (as in the datetime example below)
    >>> is_equal("1", 1)  # string == int
    True
    >>> is_equal("foo", "bar") # string != other string
    False
    >>> is_equal(1, "1") # int == string
    True
    >>> is_equal(1.0, "1") # float == string
    True
    >>> is_equal(datetime(2020, 1, 1), "2020-01-01 00:00:00") # datetime == string
    True
exhaustive equality checking, originally to compare a sqlalchemy result object of various types to a csv string
    Note: Stringifying covers object cases (as in the datetime example below)
    >>> is_equal("1", 1)  # string == int
    True
    >>> is_equal("foo", "bar") # string != other string
    False
    >>> is_equal(1, "1") # int == string
    True
    >>> is_equal(1.0, "1") # float == string
    True
    >>> is_equal(datetime(2020, 1, 1), "2020-01-01 00:00:00") # datetime == string
    True
exhaustive equality checking originally to compare a sqlalchemy result object of various types to a csv string Note : Stringifying covers object cases ( as in the datetime example below ) >>> is_equal ( 1 1 ) # string == int True >>> is_equal ( foo bar ) # string ! = other string False >>> is_equal ( 1 1 ) # int == string True >>> is_equal ( 1 . 0 1 ) # float == string True >>> is_equal ( datetime ( 2020 1 1 ) 2020 - 01 - 01 00 : 00 : 00 ) # datetime == string True
def is_equal(a, b):
    """exhaustive equality checking, originally to compare a sqlalchemy result object of various types to a csv string
    Note: Stringifying covers object cases (as in the datetime example below)
    >>> is_equal("1", 1)  # string == int
    True
    >>> is_equal("foo", "bar") # string != other string
    False
    >>> is_equal(1, "1") # int == string
    True
    >>> is_equal(1.0, "1") # float == string
    True
    >>> is_equal(datetime(2020, 1, 1), "2020-01-01 00:00:00") # datetime == string
    True
    """
    def try_else_false(comparable):
        try:
            return comparable(a, b)
        except TypeError:
            return False
        except ValueError:
            return False

    return any([
        try_else_false(lambda _a, _b: str(_a) == str(_b)),
        try_else_false(lambda _a, _b: int(_a) == int(_b)),
        try_else_false(lambda _a, _b: float(_a) == float(_b))
    ])
def is_equal ( a , b ) : def try_else_false ( comparable ) : try : return comparable ( a , b ) except TypeError : return False except ValueError : return False return any ( [ try_else_false ( lambda _a , _b : str ( _a ) == str ( _b ) ) , try_else_false ( lambda _a , _b : int ( _a ) == int ( _b ) ) , try_else_false ( lambda _a , _b : float ( _a ) == float ( _b ) ) ] )