Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Sven R. Kunze" Newsgroups: comp.lang.python Subject: Re: empty clause of for loops Date: Wed, 16 Mar 2016 11:36:09 +0100 Lines: 15 Message-ID: References: <56E93413.6090108@mail.de> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de rtCz/dv4yd3QFUeIqvTSCgnVgSqhrSmUCFubJ+KbF46g== 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; 'else:': 0.03; 'exhausted': 0.16; 'iteration': 0.16; 'iterator': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'to:name:python list': 0.16; 'wrote:': 0.16; 'memory': 0.17; 'to:2**1': 0.21; 'precise': 0.22; 'sorry,': 0.22; 'fit': 0.23; 'header:In-Reply-To:1': 0.24; 'received:10.0': 0.34; 'best,': 0.35; 'something': 0.35; 'too': 0.36; 'should': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'here.': 0.62; 'charset:windows-1252': 0.62; 'more': 0.63; 'complete': 0.63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mail201212; t=1458124570; bh=CcYMIaI04msz5toQrjA1l81on5Q0dZxw6Q/1iEfkCgU=; h=Subject:To:References:From:Date:In-Reply-To:From; b=f2lPlS2CUMOrdLjbIFEeTRxzpJmwBukd6J6cebvaJLIwdhR4KJ/H+2bO7smp4Xh8H kp8aEWEP1UU+3ImpM27PoieWAhaLqF8Tm65P+TQ/TwzmLiq0K69AklgtIhbMI4hUCl r9mc6FvXPjEl/+RptcZ5ZGTWkV/lwAN+PVKxGZvk= In-Reply-To: X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 389 X-purgate-ID: 154282::1458124569-000018ED-B623AAF1/0/0 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:105001 On 16.03.2016 11:28, Joaquin Alzola wrote: > If len(my_iterable) is not 0: > for x in my_iterable: > # do > else: > # do something else I am sorry, I should have been more precise here. my_iterable is an iterator that's exhausted after a complete iteration and cannot be restored. It's furthermore too large to fit into memory completely. Best, Sven