Path: csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!eu.feeder.erje.net!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'case.': 0.05; 'none:': 0.05; 'arguments': 0.07; 'received:mail-qc0-f174.google.com': 0.09; 'subject:while': 0.09; 'cc:addr:python-list': 0.10; 'cases': 0.15; 'in-place': 0.16; 'oct': 0.16; 'subject:expression': 0.16; 'true:': 0.16; 'wrote:': 0.17; 'bit': 0.21; 'assignment': 0.22; "i'd": 0.22; 'cc:2**0': 0.23; 'this:': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; '(which': 0.26; 'message-id:@mail.gmail.com': 0.27; 'dan': 0.29; 'fri,': 0.30; 'keyword': 0.30; 'print': 0.32; 'received:google.com': 0.34; 'clear': 0.35; 'doing': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'wanted': 0.36; 'why': 0.37; 'rather': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'some': 0.38; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'more': 0.63; '26,': 0.65; 'insanity': 0.84; 'imagine': 0.96 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=26B9SdQIGAF//EWZFV2qcKlOjtjJv6EFOaFq2jX54h4=; b=dkrePURxVlTHsoQdD8PwOHMDft9NE71eB6Le5UegpaewhkVrH9ubNG8+GFA+yjqYH8 PO1276fx7RrLYf0pCBt3a1NbNCTBnikqP4+AT68jhR2Z/IoghH9wTN0d8LFqbjFhBG/m U5bzOdApdQmtsqNPjnZuX06KstXgp0OdX6WzsLPntR1Y+/uKYdAW1YIkGcrJKg6PQUKV EiTlviqXt5fcIOv7Q/gmCgSiptWmSJ+wHswfWxmc/A9D5/8VqtkPV/DTJ/hiNCpLGAFx HLI/60Z3dB4F6lcEKsmD/uUHBvCwGjb2IhWo/UAbJoin4ErDTN+c0KgHKuo5/1YvxqGb InqA== MIME-Version: 1.0 In-Reply-To: References: <50886398.5050301@tim.thechases.com> <7x7gqf1na2.fsf@ruckus.brouhaha.com> From: Devin Jeanpierre Date: Fri, 26 Oct 2012 19:51:21 -0400 Subject: Re: while expression feature proposal To: Dan Loewenherz 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: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351295955 news.xs4all.nl 6986 [2001:888:2000:d::a6]:55262 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32248 On Fri, Oct 26, 2012 at 7:41 PM, Dan Loewenherz wrote: -- snip insanity -- > > But this is yucky. I'd much rather have something a bit more clear to the > reader. That's why I said I wanted a better iter, not some equality-overriding object strawman thing. I was thinking more like this: for profile_id in iter(None)(client.spop, "profile_ids"): or alternatively: for profile_id in iter(bool)(client.spop, "profile_ids"): Or perhaps either as keyword arguments (which is the only reason I curried iter). The interesting case for in-place assignment is not here. This is a trivial case. It's in cases like this: while True: x = foo(bar()) if x is None: break if x % 2 == 0: break print x Imagine doing that with iter. :) -- Devin