Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.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.032 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'subject:module': 0.04; 'indentation': 0.07; 'modules.': 0.07; 'either.': 0.09; 'pm,': 0.10; 'package.': 0.12; 'wrote:': 0.14; 'finney': 0.16; 'hooks': 0.16; 'thanks!': 0.16; 'cc:addr:python-list': 0.17; 'somewhere': 0.17; 'tue,': 0.17; 'header:In-Reply-To:1': 0.21; "haven't": 0.22; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'trying': 0.23; 'exploring': 0.23; 'objects,': 0.23; 'code': 0.24; 'modules': 0.26; 'url:mailman': 0.26; 'not.': 0.26; 'example': 0.27; 'message-id:@mail.gmail.com': 0.28; 'helpful': 0.28; 'problem': 0.28; 'import': 0.29; 'originally': 0.29; 'cc:addr:python.org': 0.30; 'url:listinfo': 0.30; 'module': 0.30; 'imported': 0.30; 'modules,': 0.30; 'pattern': 0.30; 'received:209.85.215': 0.30; 'anyone': 0.32; "can't": 0.32; 'apply': 0.32; 'break': 0.33; 'actually': 0.33; 'asking': 0.33; 'things': 0.33; "i've": 0.33; 'thinking': 0.34; 'however,': 0.34; 'there': 0.35; 'module.': 0.35; 'purely': 0.35; 'received:google.com': 0.37; 'something': 0.37; 'received:209.85': 0.37; 'case': 0.37; 'url:python': 0.38; 'could': 0.38; 'url:org': 0.38; 'features.': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'doing': 0.39; 'received:209': 0.39; 'initially': 0.39; 'got': 0.39; 'getting': 0.40; 'really': 0.40; 'custom': 0.60; 'your': 0.60; 'levels': 0.63; 'design': 0.63; 'ways,': 0.67; 'flow': 0.68; 'online': 0.71; 'imagine': 0.72; '(once': 0.84; 'hear,': 0.84; 'real-life': 0.84; 'lately,': 0.91; 'motivation': 0.91; 'president,': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=w4/xzp8G9+mijsHvqldCTya72l6qs++1YoZIyBGwP+E=; b=j5Ho3x8Ypa/niqI1rMW4dGbsqUl2X8wKP1jRq9X5JPM17L6X126aiF+vKEJpI50nvG eEVfRSBLGUDwlqaKzlCIl0yhmk7GgMhkKXGVA0L6SsIUzwaUah8hPoITR1emF/0FGx1U Lt9YpgX27PMgf8Frhj4vYDSZw3ZDcfn5oLRP8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=VWZE9Ag+EkYURbO/cg3HVjbHLfrIfU7MSn2zR0jzc5SUoBkkuIjFMdAnET452bnM5w j/74i0IbN6PwzE3CXTepENf5Yg3Z59OCmiwyDdhhmxeQGnBMocG4dWlel3xtIATSuAUx T1Shq+KqKCXe+FYC4zjbjKAlO5G/tiG9vCAyY= MIME-Version: 1.0 In-Reply-To: <87k4cnswt9.fsf@benfinney.id.au> References: <4DF7E75E.9000907@mrabarnett.plus.com> <87k4cnswt9.fsf@benfinney.id.au> Date: Tue, 14 Jun 2011 20:21:51 -0600 Subject: Re: break in a module From: Eric Snow To: Ben Finney Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 42 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308104514 news.xs4all.nl 49038 [::ffff:82.94.164.166]:39987 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7665 On Tue, Jun 14, 2011 at 7:33 PM, Ben Finney wr= ote: > > I have never seen code that needs this, and can't imagine why the above > would be a good design for a module. Is there real code online somewhere > that we can see which serves as a real example for your use case? > Unfortunately not. Most of this line of thinking is the result of looking at import functionality in different ways, including with regards to the problem of modules getting imported twice (once as __main__). I've been doing work on multi-file modules, custom module objects, and custom import hooks lately, so I have been exploring a lot of the import related features. The situation came up where I was trying to actually apply some of that across a large package. The use case I originally gave is the real-life one that got me thinking about module flow control statements. However, the situation that led me there is not particularly wide-spread. Keep in mind that initially I was looking to see if there was something like return or break for modules, and not asking that they be added. That "expensive module stuff" example I gave was purely hypothetical, and I haven't really seen real code like it either. Like I said, my main motivation is to reduce my levels of indentation somewhat. I was trying to see if I could apply a pattern I use in functions and loops to modules. Things like "I have never seen..." are really helpful to hear, by the way, so thanks! -eric > -- > =A0\ =A0 =A0 =A0 =A0 =A0 =93There is no reason anyone would want a comput= er in their | > =A0`\ =A0 =A0 home.=94 =97Ken Olson, president, chairman and founder of D= igital | > _o__) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0Equipment Corp., 1977 | > Ben Finney > -- > http://mail.python.org/mailman/listinfo/python-list >