Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.mixmin.net!feed.xsnews.nl!border-2.ams.xsnews.nl!newsfeed.xs4all.nl!newsfeed6.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'none:': 0.05; 'differently': 0.07; 'expressions': 0.07; 'puts': 0.07; 'behave': 0.09; 'subject:while': 0.09; 'cc:addr:python-list': 0.10; 'foo()': 0.16; 'oct': 0.16; 'operator.': 0.16; 'subject:expression': 0.16; 'syntax.': 0.16; 'wrote:': 0.17; 'variable': 0.20; 'received:209.85.216.46': 0.21; 'assignment': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'skip:( 20': 0.28; 'chris': 0.28; 'statements': 0.29; 'fri,': 0.30; 'print': 0.32; 'everyone': 0.33; 'received:google.com': 0.34; 'wrong': 0.34; 'received:209.85': 0.35; 'should': 0.36; 'two': 0.37; 'why': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'header:Received:5': 0.40; 'side': 0.61; '26,': 0.65; 'bar:': 0.84; 'confusing': 0.84; 'subtly': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=X0mWNBKDSMYhe/x7+elOeXZxVUKHZcar6Zl0pH3NNEo=; b=KbDIA+k4GMpmcQkrI85ElKaPn36iHyPyQiKw1XqfQVatEaLXxC+ZNTvksjpF7tRVK8 GIIuxoE2SX4m7i6E27kxC8fHAibIoLl0sICbBYSUo5pHQNTR/yNSRLKI52fFuy0oSzqs wCo6NrEnrsGuufTybD6k/g5XnJO7jBBsYx9Fd2m92MAnPqIctGykpVLDUSkO3obFNgPs 7TxkH4s5i4GO4CjSeJ0ijbWq2/vCobZLZpg+AfDJqFwuN77zBrNCF3VdUDJCmG6wgkcb k/gRAQZl+pJgsE6gbzoAT4sHEVmI9sX6w1KyOmuncBfGxp9/OpASFr/QPoLIdm+FpgeH uwPA== MIME-Version: 1.0 In-Reply-To: References: <50886398.5050301@tim.thechases.com> <7x7gqf1na2.fsf@ruckus.brouhaha.com> <7x7gqdzs1i.fsf@ruckus.brouhaha.com> From: Devin Jeanpierre Date: Fri, 26 Oct 2012 19:19:42 -0400 Subject: Re: while expression feature proposal To: Chris Angelico Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351293624 news.xs4all.nl 6923 [2001:888:2000:d::a6]:35305 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32243 On Fri, Oct 26, 2012 at 2:23 AM, Chris Angelico wrote: > while (client.spop("profile_ids") as profile_id) is not None: > print profile_id > > Why is everyone skirting around C-style assignment expressions as > though they're simultaneously anathema and the goal? :) Why should these two statements behave differently? :( with foo() as bar: bar.baz() with (foo() as bar): bar.baz() I don't understand why everyone is so attached to this "as" syntax. It's confusing because it behaves subtly differently than how it works in "with", and it puts the variable on the wrong side of the assignment operator. (I've always been partial to ":=", personally.) -- Devin