Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1a.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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:()': 0.09; 'subject:while': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; '>>>>': 0.31; 'subject:About': 0.31; 'fri,': 0.33; 'received:google.com': 0.35; 'false': 0.36; 'yield': 0.36; 'done': 0.36; 'ensure': 0.60; 'cheating': 0.84; '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=pdyF1larSsfuOXBRafjzXoL1mqjKf3Xh4g8WM9NFTvY=; b=nRq5YBBS3WjCtw9hd0Zs4dhB7w2NePK6P5EARZWdN5TcxIy9+qwu+5kl7FqGhTzQtP 8atwwnQT8X6RInGv54NHRaZsz7rCpeUyYxI5CiD2BJxHzR2UZOdqATuOTmMBRom2XpGK XDfshByACtV1LjYdurHhJb7Uttc1nsyOYlWP2Ea8FU0bBuk6TuMngtHlxxZBYemyWC6D cnI2HihDam0TBZ1hQ52ZqsANRKoOei4M8IRace/KxB9EMIk7jSMr8KiXKz1vkzm3elAz HHYyNTKljNRuscECPgJ5KQlY0f0eR82O1P+JQfkwrLjncFhf7e1kViNjlHSkyhAqtBky ZBHQ== MIME-Version: 1.0 X-Received: by 10.58.77.9 with SMTP id o9mr225716vew.69.1402592225854; Thu, 12 Jun 2014 09:57:05 -0700 (PDT) In-Reply-To: References: <8d6207ab-b883-4940-8e53-75546a91d4dd@googlegroups.com> Date: Fri, 13 Jun 2014 02:57:05 +1000 Subject: Re: About python while statement and pop() 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.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: 1402592234 news.xs4all.nl 2948 [2001:888:2000:d::a6]:52837 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:73223 On Fri, Jun 13, 2014 at 2:49 AM, Mark H Harris wrote: > Consider this generator variation: > >>>> def poplist(L): > done = False > while done==False: > > yield L[::-1][:1:] > L = L[::-1][1::][::-1] > if len(L)==0: done=True Why not just "while L"? Or are you deliberately trying to ensure that cheating will be detectable? ChrisA