Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.048 X-Spam-Evidence: '*H*': 0.91; '*S*': 0.00; 'else:': 0.03; 'subject:PEP': 0.07; 'function:': 0.09; 'def': 0.12; '24,': 0.16; 'meanwhile': 0.16; 'wei': 0.16; 'wrote:': 0.18; 'basically': 0.19; 'code,': 0.22; 'mon,': 0.24; 'somewhere': 0.26; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'raise': 0.29; 'message- id:@mail.gmail.com': 0.30; 'received:google.com': 0.35; 'raising': 0.36; 'possible': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'moving': 0.39; 'to:addr:python.org': 0.39; 'subject:? ': 0.60; 'break': 0.61; 'skip:n 10': 0.64; 'taking': 0.65; 'within': 0.65; 'rendering': 0.68; 'subject:this': 0.83; '2013': 0.98 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 :content-type; bh=m6VEtCbLykGd3aXLmsUB0+1NqklcwFZGg+7TfBdF/bU=; b=ejQuOEATH1Nsz2n7oAF7odfIFu6KYe6haxeT29GF5smRHZP4GNZT5XeZ1fDNyOKmG5 ZbtHxaAkX0bCfiviTLnV1Ij3MCSUFBLfi7l7Zw7Skb9jQNoSlsFpMrxa8Up5BFVmsAmt z/H+AfCalgaugMsfylvfpJVDRAhyxzGgFLO+U+cVMrZZNYD/D9MxfeEK/2QhMdpe4UQk bZziOVMpZM87+L/BVzDCczS085TlzVGszMX4+LF9HlBfum7mPj0c0CxCJFfTB4FhHeN/ s7p+qhuF4UXB9vakeL+R7YIxxXHpfyEHiV5h9Lc1EyDztQSqbd+zk0OREMdM7W2z3V2W ZpTQ== X-Received: by 10.66.146.9 with SMTP id sy9mr31120198pab.16.1372135899683; Mon, 24 Jun 2013 21:51:39 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <8D03F2B8CF0E7BE-1864-1796B@webmail-m103.sysops.aol.com> From: Ian Kelly Date: Mon, 24 Jun 2013 22:50:59 -0600 Subject: Re: Is this PEP-able? fwhile To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372135909 news.xs4all.nl 15885 [2001:888:2000:d::a6]:46690 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49127 On Mon, Jun 24, 2013 at 6:41 PM, wu wei wrote: > It's still possible by raising a StopIteration within the condition > function: > > def is_part_of_header(x): > if header_condition: > return True > else: > raise StopIteration Which is basically just taking the break and moving it to somewhere else in the code, and meanwhile rendering the is_part_of_header function non-reusable.