On Thu, Jun 19, 2014 at 3:48 AM,  <subhabangal...@gmail.com> wrote:
> I am trying to see this line,
> prev_f_sum = sum(f_prev[k]*a[k][st] for k in states)
> a[k][st], and f_prev[k] I could take out and understood.
> Now as it is doing sum() so it must be over a list,
> I am trying to understand the number of entities in the list, thinking 
> whether to put len(), and see for which entities it is doing the sum.

It's summing a generator expression, not a list.  If it helps to
understand it, you could rewrite that line like this:

values_to_be_summed = []
for k in states:
prev_f_sum = sum(values_to_be_summed)

So the number of entities in the list is len(states).

Reply via email to