vm wrote in news:in4m1u$hsc$1...@news2.carnet.hr in gmane.comp.python.general:
> def fun1(params_used_below_except_lk_and_lk2): > lk = 0.0 > lk2 = 0.0 > for raw_data, hist, freq in raw_data_hist_list: > lk2 = lk2 + fun2(some_constants_and_params_from_this_scope) > q = fun2(same_args_as_before) > lk = lk + q > print lk, lk2 > > For some set of input parameters, This function with specific input > prints out the same constant twice (as expected): > > 15377.7424582 15377.7424582 (twice the same value) > > If I comment out lines q = fun2.... and lk = lk + q, fun1, with the > same parameters, prints: > > 0.0 3.3469936856 > > First value is expected, but I cannot understand how come the second > value is different in these two cases! Clearly the value returned by fun2 (get_beta_func_fit_quality_hist_lk) is different the second time you call it. So it either depends on and modifies a global or a value referenced or contained in one of the arguments. Rob. -- http://mail.python.org/mailman/listinfo/python-list