def memoized_parse_block(code):
    """Memoized version of parse_block."""
    success, result = parse_block_memo.get(code, (None, None))
    if success is None:
        try:
            parsed = COMPILER.parse_block(code)
        except Exception as err:
            success, result = False, err
        else:
            success, result = True, parsed
        parse_block_memo[code] = (success, result)
    if success:
        return result
    else:
        raise result
def memoized_parse_block ( code ) : success , result = parse_block_memo . get ( code , ( None , None ) ) if success is None : try : parsed = COMPILER . parse_block ( code ) except Exception as err : success , result = False , err else : success , result = True , parsed parse_block_memo [ code ] = ( success , result ) if success : return result else : raise result
Memoized version of parse_block.