Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.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.051 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'changes': 0.15; '-tkc': 0.16; 'charles': 0.16; 'deletions': 0.16; 'elsewhere.': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'iteration': 0.16; 'passes,': 0.16; 'subject: \n ': 0.16; 'wrote:': 0.18; "shouldn't": 0.24; 'header:In-Reply-To:1': 0.27; 'room': 0.29; 'subject:all': 0.32; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'in.': 0.36; 'charset :us-ascii': 0.36; "i'll": 0.36; 'to:addr:python-list': 0.38; 'expect': 0.39; 'to:addr:python.org': 0.39; 'deleting': 0.60; 'new': 0.61; 'further': 0.61; 'back': 0.62; 'details': 0.65; 'between': 0.67; 'received:50.22': 0.84 Date: Sat, 26 Apr 2014 15:24:03 -0500 From: Tim Chase To: python-list@python.org Subject: Re: Proper deletion of selected items during map iteration in for loop: Thanks to all In-Reply-To: <535C0827.3010800@earthlink.net> References: <535AA12A.1030203@earthlink.net> <535C0827.3010800@earthlink.net> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Get-Message-Sender-Via: boston.accountservergroup.com: authenticated_id: tim@thechases.com 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1398543855 news.xs4all.nl 2958 [2001:888:2000:d::a6]:51664 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70640 On 2014-04-26 12:25, Charles Hixson wrote: > I expect that I'll be deleting around 1/3 during > each iteration of the process...and then adding new ones back in. > There shouldn't be a really huge number of deletions on any > particular pass, but it will be looped through many times... If you have further details on what triggers the "adding new ones back in", and what changes or remains the same between various passes, there might be room for optimization elsewhere. -tkc