(tokens, local_dict, global_dict)
return result
Substitutes "lambda" with its Sympy equivalent Lambda().
    However, the conversion doesn't take place if only "lambda"
    is passed because that is a syntax error.
Substitutes "lambda" with its Sympy equivalent Lambda().
    However, the conversion doesn't take place if only "lambda"
    is passed because that is a syntax error.
Substitutes lambda with its Sympy equivalent Lambda () . However the conversion doesn t take place if only lambda is passed because that is a syntax error .
def lambda_notation(tokens, local_dict, global_dict):
    """Substitutes "lambda" with its Sympy equivalent Lambda().
    However, the conversion doesn't take place if only "lambda"
    is passed because that is a syntax error.

    """
    result = []
    flag = False
    toknum, tokval = tokens[0]
    tokLen = len(tokens)
    if toknum == NAME and tokval == 'lambda':
        if tokLen == 2:
            result.extend(tokens)
        elif tokLen > 2:
            result.extend([
                (NAME, 'Lambda'),
                (OP, '('),
                (OP, '('),
                (OP, ')'),
                (OP, ')'),
            ])
            for tokNum, tokVal in tokens[1:]:
                if tokNum == OP and tokVal == ':':
                    tokVal = ','
                    flag = True
                if flag:
                    result.insert(-1, (tokNum, tokVal))
                else:
                    result.insert(-2, (tokNum, tokVal))
    else:
        result.extend(tokens)

    return result
def lambda_notation ( tokens , local_dict , global_dict ) : result = [ ] flag = False toknum , tokval = tokens [ 0 ] tokLen = len ( tokens ) if toknum == NAME and tokval == 'lambda' : if tokLen == 2 : result . extend ( tokens ) elif tokLen > 2 : result . extend ( [ ( NAME , 'Lambda' ) , ( OP , '(' ) , ( OP , '(' ) , ( OP , ')' ) , ( OP , ')' ) , ] ) for tokNum , tokVal in tokens [ 1 : ] : if tokNum == OP and tokVal == ':' : tokVal = ',' flag = True if flag : result . insert ( - 1 , ( tokNum , tokVal ) ) else : result . insert ( - 2 , ( tokNum , tokVal ) ) else : result . extend ( tokens ) return result