Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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; 'python,': 0.02; 'subject:both': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'kern': 0.16; 'range(0,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'underlying': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'header:User- Agent:1': 0.23; 'error': 0.23; 'interpret': 0.24; 'this:': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'robert': 0.30; "i'm": 0.30; 'gives': 0.31; "can't": 0.35; 'subject:one': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'no.': 0.61; 'times': 0.62; 'our': 0.64; 'world': 0.66; 'believe': 0.68; 'eco': 0.84; 'terrible': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robert Kern Subject: Re: Having both if() and for() statements in one liner Date: Tue, 17 Sep 2013 13:52:35 +0100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 213.1.240.226 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 In-Reply-To: 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1379422507 news.xs4all.nl 15987 [2001:888:2000:d::a6]:47947 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:54292 On 2013-09-17 13:02, Ferrous Cranus wrote: > o want to avoid having to type somehting like this: > > if person="George": > times in range(0, 5): > > > Why it gives me an error when i'm trying to write it like this: > > > if person="George" for times in range(0, 5): > > Can't i ahve both if and for in a one liner? Not in Python, no. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco