Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!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.037 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'iterate': 0.09; 'assume': 0.11; 'to:name:python-list': 0.15; 'points:': 0.16; 'items.': 0.17; "i'd": 0.22; "i've": 0.23; 'wondering': 0.26; 'message- id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'run': 0.28; 'restart': 0.29; 'points': 0.29; 'point': 0.31; 'received:74.125.82': 0.33; 'to:addr:python-list': 0.33; 'point.': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'received:74.125': 0.36; 'be.': 0.36; 'far': 0.37; 'to:addr:python.org': 0.39; 'subject:over': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=erL3p21Ir7giF0OANJVT735AGfuH/6ah/neltn7TrH0=; b=Gt4wd9y71oAqTk4jnHvOvLDi9Jz3AGd/UwCWYrvwzvwv5OCHYYA13IoThT4uUHrjub nrU/HD3dSZXDg9HeuZNcbGQe1IhFccABfQSLZBBZ0W8AA0vK0Fs726eZBUiG6Dk4npi9 F7ygPBanY1JyMIribp3ut3kLXbLrnYy/dyz4zrxd/+6XvmxhzwsD1XiijgIlAcfkbpew HR/y/2cqUOj5XWs2jq/d0nRSNXzN4bVpuF38O/rGg/9LdxEuvwJ4UN7a3sHgJl8MjpZn jzMHktI0dzxT3U3O0AtnAsGmNwpjLqb3Q2XDDC3FaXwnfo0FfgN8wgIVEB4MMtfiAAyG VMPQ== MIME-Version: 1.0 X-Received: by 10.180.87.129 with SMTP id ay1mr25344823wib.1.1362648200336; Thu, 07 Mar 2013 01:23:20 -0800 (PST) Date: Thu, 7 Mar 2013 09:23:20 +0000 Subject: iterating over a list as if it were a circular list From: Sven To: python-list Content-Type: multipart/alternative; boundary=f46d0444e889ef5f3104d7524183 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: 1362648214 news.xs4all.nl 6950 [2001:888:2000:d::a6]:51424 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40726 --f46d0444e889ef5f3104d7524183 Content-Type: text/plain; charset=ISO-8859-1 I was wondering what the best approach for the following might be. Say you have a list P of points and another list N of other items. You can always assume that len(N) <= len(P) Now I would like to iterate over P and place one N at each point. However if you run out of N I'd like to restart from N[0] and carry on until all the points have been populated. So far I've got for point in points: -- ./Sven --f46d0444e889ef5f3104d7524183 Content-Type: text/html; charset=ISO-8859-1
I was wondering what the best approach for the following might be.

Say you have a list P of points and another list N of other items. You can always assume that

len(N) <= len(P)

Now I would like to iterate over P and place one N at each point. However if you run out of N I'd like to restart from N[0] and carry on until all the points have been populated.
So far I've got

for point in points:


--
./Sven
--f46d0444e889ef5f3104d7524183--