Module Assign NameStore Str If CompareEq NameLoad Str body ImportFrom alias ImportFrom alias Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore IfExp CompareEq NameLoad Str NameLoad NameLoad Assign NameStore Dict FunctionDef arguments args NameParam defaults vararg kwarg body Expr Str Assign NameStore AttributeLoad NameLoad attr FunctionDef arguments args defaults vararg kwarg body Assign NameStore TupleLoad NameLoad NameLoad Print NameLoad If CompareIn NameLoad Call AttributeLoad NameLoad attr body Print Str Assign NameStore TupleLoad NameLoad NameLoad Return SubscriptLoad NameLoad Index NameLoad orelse Print Str Assign NameStore Call NameLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Return NameLoad decorator_list Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg kwarg body Expr Str Assign NameStore AttributeLoad NameLoad attr FunctionDef arguments args defaults vararg kwarg body Assign NameStore TupleLoad NameLoad NameLoad TryExcept body Assign NameStore TupleLoad NameLoad NameLoad Return SubscriptLoad NameLoad Index NameLoad handlers ExceptHandler type NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Return NameLoad decorator_list Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Num For NameStore Call NameLoad NameLoad body For NameStore Call NameLoad NameLoad body AugAssignAdd NameStore BinOpPow NameLoad NameLoad Return NameLoad decorator_list NameLoad NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Num For NameStore Call NameLoad NameLoad body For NameStore Call NameLoad NameLoad body AugAssignAdd NameStore BinOpPow NameLoad NameLoad Return NameLoad decorator_list NameLoad NameLoad If NameLoad body With Call NameLoad Str body For NameStore Call NameLoad Num body Assign NameStore BinOpMult NameLoad Num Assign NameStore TupleLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assert CompareEq NameLoad NameLoad Print Str Assign NameStore TupleLoad Num Num Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad
N/A N/A __author__ Chris Tabor (dxdstudio@gmail.com) N/A N/A __name__ __main__ N/A os getcwd os sys N/A N/A N/A N/A sys path append N/A getcwd MOAL.helpers.display Section MOAL.helpers.trials test_speed functools wraps N/A DEBUG N/A N/A __name__ __main__ True False N/A memoized N/A memoize N/A N/A func N/A args kwargs N/A N/A A decorator that memoizes the results of a decorated function. N/A funcname N/A func __name__ _inner N/A N/A N/A args kwargs N/A N/A key N/A funcname args N/A key N/A N/A key N/A N/A memoized keys N/A N/A Getting memoized version! N/A key N/A funcname args N/A N/A memoized N/A key N/A N/A Calling normal function N/A res N/A func args kwargs N/A N/A memoized N/A key res N/A res N/A N/A wraps func N/A _inner N/A memoize_lookuptable N/A N/A func N/A args kwargs N/A N/A A decorator that memoizes the results of a decorated function.
    Instead of checking if key is in keys, it attempts to access the
    property directly, like a typical lookup table. N/A funcname N/A func __name__ _inner N/A N/A N/A args kwargs N/A N/A key N/A funcname args N/A N/A N/A key N/A funcname args N/A N/A memoized N/A key N/A N/A N/A KeyError N/A N/A res N/A func args kwargs N/A N/A memoized N/A key res N/A res N/A N/A wraps func N/A _inner N/A dolongthing N/A N/A max_x max_y N/A N/A N/A Does a nested loop - running time is O(n^2)

    Args:
        max_x (int) - An integer for max outer loop
        max_y (int) - An integer for max inner loop
    Returns:
        res (int) - The resultant calculation
     N/A res 0 N/A x N/A range max_x N/A N/A y N/A range max_y N/A N/A res N/A x y N/A res N/A test_speed memoize dolongthing2 N/A N/A max_x max_y N/A N/A N/A res 0 N/A x N/A range max_x N/A N/A y N/A range max_y N/A N/A res N/A x y N/A res N/A test_speed memoize_lookuptable N/A DEBUG N/A N/A N/A Section Optimization - memoization N/A N/A x N/A range 4 N/A N/A arg N/A x 100 N/A args N/A arg arg N/A res N/A dolongthing args N/A res2 N/A dolongthing args N/A N/A res res2 N/A Comparing memoization with lookup table vs. if check. N/A args N/A 500 500 N/A res1 N/A dolongthing args N/A res2 N/A dolongthing2 args