Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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; 'exceeds': 0.09; 'explanation': 0.09; 'overwrite': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrapped': 0.09; 'assume': 0.14; 'finney': 0.16; 'guys,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'trying': 0.19; 'value.': 0.19; 'input': 0.22; 'example': 0.22; 'header:User-Agent:1': 0.23; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; 'fixed': 0.29; "doesn't": 0.30; 'subject:list': 0.30; 'writes:': 0.31; 'this.': 0.32; 'sense': 0.34; 'something': 0.35; 'but': 0.35; 'list': 0.37; 'ben': 0.38; 'lists.': 0.38; 'to:addr:python-list': 0.38; 'list,': 0.38; 'expect': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'numbers': 0.61; 'first': 0.61; 'different': 0.65; 'email addr:live.com': 0.68; 'truth': 0.81; 'case?': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ben Finney Subject: Re: Wrapping around a list in Python. Date: Mon, 16 Dec 2013 15:59:32 +1100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: rasputin.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-gpg.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:T+EEKOwaXIeNu8koBNSIwbL35mY= 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387169987 news.xs4all.nl 2898 [2001:888:2000:d::a6]:50997 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62001 shengjie.shengjie@live.com writes: > Hi guys, I am trying to create a fixed list which would allow my > values to be wrapped around it. This doesn't make a lot of sense to me, but I assume you have a purpose in mind for this. What is the purpose? Perhaps it will help the explanation if we know what it's for. > For example i have 10 values : 0,1,2,3,4,5,6,7,8,9 Does this mean the input is a list, ‘[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]’? Or do you mean something else? What is the input? > I need to create a list which contains 4 numbers and when the number > exceeds the list, it would overwrite the first value. > [0,1,2,3] > [4,1,2,3] > [5,4,1,2] That's three different lists. What is the input in each case? Under what circumstances would you expect each one to be produced? -- \ “As scarce as truth is, the supply has always been in excess of | `\ the demand.” —Josh Billings | _o__) | Ben Finney