Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'found,': 0.07; 'computed': 0.09; 'newly': 0.09; 'creates': 0.14; 'calculates': 0.16; 'dict': 0.16; 'iteration': 0.16; 'loop.': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'later': 0.20; 'subject:Code': 0.24; 'script': 0.25; 'first,': 0.26; 'values': 0.27; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'reply.': 0.31; 'calculated': 0.31; 'checked': 0.32; 'but': 0.35; 'received:google.com': 0.35; 'next': 0.36; 'thank': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'previous': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'new': 0.61; 'making': 0.63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=APy/gBmwJXx4SfOO+CkjToEsUx+SVPzGWo4tqW6Y6fA=; b=r/HBXh5ur4GOsGpilI6XqYwrK8TrQfXkm1JkMGpE5BQcn1T5zTf7Kox799MGJlcyR4 rcrW43s8cNYNYep+QHaKlUyUu6u6mU1I81jg8506oOrJ5EAgwXRuScpdoruGyXrs+5R1 9koyIToud7wHIgwOTqrx2qs0S2ejPowarU/iO72R9XI3g70JpMQCarZ4dBP6VmX1p5ET sxDb/lHBMp87QlIpoHiqXFXMDBY6HNK/gfA4bhCjiBXIO3bvAMyxaMylUKGkSxea8j72 Ti2Kl46RymFrmb2oHg04Vh20RXOX+J0PmTBhUZHUhECLScL8ysfNkOerlWDo+LdAGn8S K5WQ== X-Received: by 10.236.179.69 with SMTP id g45mr4688117yhm.81.1403161252568; Thu, 19 Jun 2014 00:00:52 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <03a82bc4-340f-4b16-8dbb-791b706c7862@googlegroups.com> References: <4045d8ca-923d-4384-a684-57cbd80ab7b7@googlegroups.com> <03a82bc4-340f-4b16-8dbb-791b706c7862@googlegroups.com> From: Ian Kelly Date: Thu, 19 Jun 2014 01:00:12 -0600 Subject: Re: Understanding Python Code To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1403161255 news.xs4all.nl 2829 [2001:888:2000:d::a6]:38213 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:73395 On Wed, Jun 18, 2014 at 11:50 PM, 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?