Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!feeder2.cambriumusenet.nl!feed.tweaknews.nl!194.134.4.91.MISMATCH!news2.euro.net!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; 'skipping': 0.07; 'iterate': 0.09; 'none):': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'paulo': 0.16; 'process?': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:t-dialin.net': 0.16; 'thru': 0.16; 'wrote:': 0.16; '>>>': 0.18; 'subject:list': 0.21; 'from:addr:web.de': 0.23; 'import': 0.27; 'example': 0.28; 'list:': 0.30; 'list': 0.32; 'to:addr:python-list': 0.33; 'nobody': 0.34; 'header:X-Complaints-To:1': 0.34; '...': 0.35; 'especially': 0.35; 'element': 0.36; 'two': 0.37; 'received:org': 0.37; 'should': 0.38; 'subject:from': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.40; 'huge': 0.60; '1st': 0.70; 'subject:2nd': 0.84; 'subject:huge': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: Iterate from 2nd element of a huge list Date: Wed, 01 Feb 2012 09:11:44 +0100 Organization: None References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p5084ae86.dip.t-dialin.net X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328083912 news.xs4all.nl 6971 [2001:888:2000:d::a6]:42767 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19694 Arnaud Delobelle wrote: >> Em 01-02-2012 01:39, Paulo da Silva escreveu: >>> What is the best way to iterate thru a huge list having the 1st element >>> a different process? I.e.: > Nobody mentioned itertools.islice, which can be handy, especially if > you weren't interested in the first element of the list: Also, skipping two or seven or ... items is just as easy. The example should be > from itertools import islice: for el in islice(mylist, 1, None): > process2(el)