comparison bin/curvecalc @ 283:e76b112c837e

fix empty-subexpr bug
author Drew Perttula <drewp@bigasterisk.com>
date Fri, 17 Jun 2005 20:49:20 +0000
parents d482699decbd
children 304a918e7488
comparison
equal deleted inserted replaced
282:d482699decbd 283:e76b112c837e
129 """one Submaster and its Subexpr""" 129 """one Submaster and its Subexpr"""
130 def __init__(self, submaster, subexpr): 130 def __init__(self, submaster, subexpr):
131 make_attributes_from_args('submaster', 'subexpr') 131 make_attributes_from_args('submaster', 'subexpr')
132 def scaled(self, t): 132 def scaled(self, t):
133 subexpr_eval = self.subexpr.eval(t) 133 subexpr_eval = self.subexpr.eval(t)
134 # this stops an error that didn't used to happen. i think when
135 # the expr is empty, subexpr_eval becomes None, so this zero
136 # is ok
137 if subexpr_eval is None:
138 subexpr_eval = 0
134 if isinstance(subexpr_eval, Submaster.Submaster): 139 if isinstance(subexpr_eval, Submaster.Submaster):
135 # if the expression returns a submaster, just return it 140 # if the expression returns a submaster, just return it
136 return subexpr_eval 141 return subexpr_eval
137 else: 142 else:
138 # otherwise, return our submaster multiplied by the value returned 143 # otherwise, return our submaster multiplied by the value returned