From a97b53d4bd653099d68fe527ffb7f8764583231b Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Sun, 15 Jan 2012 20:25:12 -0500 Subject: [PATCH] Allow use of 'prex' in precalc statements --- cuburn/code/variations.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cuburn/code/variations.py b/cuburn/code/variations.py index 0f5105f..783aae3 100644 --- a/cuburn/code/variations.py +++ b/cuburn/code/variations.py @@ -23,9 +23,10 @@ def var(num, name, code, params=None): # TODO: This is a shitty hack def precalc(name, code): - def precalc_fun(pv): + def precalc_fun(pv, px=None): pre = pv._precalc() - pre._code(Template(code, name+'_precalc').substitute(pre=pre)) + prex = px._precalc() if px is not None else None + pre._code(Template(code, name+'_precalc').substitute(**locals())) Template.default_namespace[name+'_precalc'] = precalc_fun # Variables note: all functions will have their weights as 'w',