On Wed, Jun 18, 2014 at 10:36 AM, <subhabangal...@gmail.com> wrote: > The questions are, > i) prev_f_sum = sum(f_prev[k]*a[k][st] for k in states) > here f_prev is called, > f_prev is assigned to f_curr ["f_prev = f_curr"] > f_curr[st] is again being calculated as, ["f_curr[st] = e[st][x_i] * > prev_f_sum"] which again calls "prev_f_sum" > > I am slightly confused which one would be first calculated and how to proceed > next?
These things that you describe as "calls" are not calls. f_prev and f_curr are data structures (in this case dicts), not functions. Accessing "f_prev[k]" does not call f_prev or in any way cause f_prev[k] to be computed; it just looks up what value is recorded in the f_prev dict for the key k. Python is an imperative language, not declarative. If you want to know what order these things are calculated in, just follow the program flow. -- https://mail.python.org/mailman/listinfo/python-list