Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105001

Re: empty clause of for loops

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From "Sven R. Kunze" <srkunze@mail.de>
Newsgroups comp.lang.python
Subject Re: empty clause of for loops
Date Wed, 16 Mar 2016 11:36:09 +0100
Lines 15
Message-ID <mailman.188.1458124572.12893.python-list@python.org> (permalink)
References <56E93413.6090108@mail.de> <DB5PR07MB149603DF925D4DA9DC564D77F08A0@DB5PR07MB1496.eurprd07.prod.outlook.com>
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 <srkunze@mail.de>
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 <DB5PR07MB149603DF925D4DA9DC564D77F08A0@DB5PR07MB1496.eurprd07.prod.outlook.com>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:105001

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: empty clause of for loops "Sven R. Kunze" <srkunze@mail.de> - 2016-03-16 11:36 +0100

csiph-web