Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.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.096 X-Spam-Evidence: '*H*': 0.81; '*S*': 0.01; 'intermediate': 0.07; 'subject:missing': 0.07; 'calculating': 0.09; 'cc:addr:python- list': 0.11; '24,': 0.16; 'caching': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'non-trivial': 0.16; 'subject: ?': 0.16; 'wrote:': 0.18; 'separate': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'question': 0.24; 'cc:2**0': 0.24; 'least': 0.26; 'values': 0.27; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'along.': 0.31; 'subject:what': 0.31; 'values.': 0.31; 'entirely': 0.33; 'could': 0.34; 'received:google.com': 0.35; 'sequence': 0.36; 'example,': 0.37; 'performance': 0.37; 'step': 0.37; 'list,': 0.38; 'rather': 0.38; 'even': 0.60; 'dave': 0.60; 'number,': 0.60; 'back': 0.62; 'save': 0.62; "you've": 0.63; 'soon': 0.63; 'mar': 0.68; 'gain': 0.79; 'potentially': 0.81; '2015': 0.84; 'angel': 0.91; 'capture': 0.91; 'fibonacci': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=E0eveYco+hS7VFbJEW9g12mXBje1rfl677fw3q+r3Fs=; b=Q8JoKrMPjIFvhzPg0ywD9lLVVOjyNqDOo19Lq5XiJahERiw3i9iD4v8RtpXGeUlxTa yaCFDC3RBLlxQRO5XnoKs+G/Ea4lr8DdVnh8kO6iKqRxC1E3sNpDNuibEuF9LT3pIuQn lHyyC5kLZxwUfIrbDXUnDCE7gZcnrtOuFHMQrggNN53T+c24wHABqq/SIb13dicBmR42 kLXnJtITrsBSKARBj1glswJQVgvSbfLoRi7RNqaPTn1A5258XP5UBJnTwZxU+p/QadBE egUNQBIxJ1Gffuf7Qy8nBQRoNsGRB66YxPzFMJ2C2EpFuusmxpzfcW0B1Mic+VnF/K7n lztw== MIME-Version: 1.0 X-Received: by 10.43.38.144 with SMTP id ti16mr20739895icb.26.1427129991371; Mon, 23 Mar 2015 09:59:51 -0700 (PDT) In-Reply-To: <55103C5D.4070305@davea.name> References: <55103C5D.4070305@davea.name> Date: Tue, 24 Mar 2015 03:59:51 +1100 Subject: Re: fibonacci series what Iam is missing ? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 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: 1427129999 news.xs4all.nl 2935 [2001:888:2000:d::a6]:45353 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:87837 On Tue, Mar 24, 2015 at 3:16 AM, Dave Angel wrote: > An entirely separate question is whether you can gain performance by caching > intermediate values. For example, if you capture values in a list, you > could potentially save a lot of time, at least for non-trivial values of n. If you take a step back and seek to print a sequence of Fibonacci numbers, rather than calculating specific ones based on their indices, then you don't even need to consider caching. As soon as you've printed out a number, you move right along. ChrisA