Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73395

Re: Understanding Python Code

References <4045d8ca-923d-4384-a684-57cbd80ab7b7@googlegroups.com> <mailman.11118.1403118997.18130.python-list@python.org> <03a82bc4-340f-4b16-8dbb-791b706c7862@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2014-06-19 01:00 -0600
Subject Re: Understanding Python Code
Newsgroups comp.lang.python
Message-ID <mailman.11131.1403161255.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Jun 18, 2014 at 11:50 PM,  <subhabangalore@gmail.com> wrote:
> Thank you for the reply. But as I checked it again I found,
> f_prev[k] is giving values of f_curr[st] = e[st][x_i] * prev_f_sum
> which is calculated later and again uses prev_f_sum.

f_prev is the f_curr that was calculated on the previous iteration of
the loop.  At each iteration after the first, the script calculates
f_curr based on the value of f_prev, that is, the old value of f_curr.
Then it reassigns the newly computed f_curr to f_prev, making it now
the previous, and on the next iteration it creates a new dict to store
the next f_curr.  Does that make sense?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Understanding Python Code subhabangalore@gmail.com - 2014-06-18 09:36 -0700
  Re: Understanding Python Code Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-18 13:15 -0600
    Re: Understanding Python Code subhabangalore@gmail.com - 2014-06-18 22:50 -0700
      Re: Understanding Python Code Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-19 01:00 -0600
        Re: Understanding Python Code subhabangalore@gmail.com - 2014-06-19 02:48 -0700
          Re: Understanding Python Code Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-19 08:09 -0600
            Re: Understanding Python Code subhabangalore@gmail.com - 2014-06-19 07:27 -0700
              Re: Understanding Python Code subhabangalore@gmail.com - 2014-06-19 11:44 -0700
                Re: Understanding Python Code Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-19 13:07 -0600
                Understanding Python Code[Forward_Backward_Wikipedia] subhabangalore@gmail.com - 2014-06-21 15:05 -0700

csiph-web