Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:module': 0.04; 'exits': 0.07; 'fine,': 0.07; 'francis': 0.07; 'imports': 0.07; 'though.': 0.07; 'python': 0.08; 'erik': 0.09; 'etc).': 0.09; 'globals': 0.09; 'modifies': 0.09; 'namespace': 0.09; 'syntax.': 0.09; 'top-level': 0.09; 'pm,': 0.10; 'wrote:': 0.14; 'defined': 0.14; 'bindings': 0.16; 'constants': 0.16; 'dumps': 0.16; 'global,': 0.16; 'keyword.': 0.16; 'looping': 0.16; 'structures,': 0.16; '16,': 0.16; "wouldn't": 0.17; 'cc:addr:python-list': 0.17; 'keyword': 0.19; '(which': 0.20; 'header:In-Reply-To:1': 0.21; 'seems': 0.21; 'thu,': 0.22; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'testing,': 0.23; "what's": 0.23; 'code': 0.24; 'certainly': 0.25; 'received:209.85.220': 0.25; 'not.': 0.26; 'example': 0.27; 'message-id:@mail.gmail.com': 0.28; 'import': 0.29; "he's": 0.29; 'bit': 0.30; "won't": 0.30; 'cc:addr:python.org': 0.30; 'module': 0.30; 'annoying': 0.30; 'separate': 0.31; 'usually': 0.32; "can't": 0.32; 'done,': 0.32; 'does': 0.33; '...': 0.34; 'membership': 0.34; 'change,': 0.35; 'visible': 0.35; 'using': 0.35; 'quite': 0.36; 'actual': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.37; 'two': 0.37; 'could': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'received:209': 0.39; 'kind': 0.60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=M9LEg1TgPrLGIupxin4nSkPJwwpYLX1Jijoacs5Fd4Y=; b=i1AF9YTEZTRmTUtL4OBm95yDdD81A/BMiBJDcveVd9nI7jq8kvEVM0jtjU0XOGRAh0 8idgcrYrZojmv0GzasJAy7EiaTDww+7IYcwXl9gCKiTS2FuucRgHc0toQOnVibXlhH/a 3YdsXQU6j3lGIXvZiuwwY+7W7WUsSjcQVVxJc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=rf+qGKMiPxbLN/EILvRvDiy6JAUBAy7TW5WEl4ToGQGI0g7l+K51D7ORG4WDjkJErd Vx/WXxYue2pBIp9A4yY+xGJAiL7y1hYBVxwgPyq84p/MthDDDph8yYBOHgf8WCLf3V+i tXGgAmHvaSHrN6DDgJALInvhVzUFNfVxNQWI8= MIME-Version: 1.0 In-Reply-To: References: <4DF7E75E.9000907@mrabarnett.plus.com> <6NWdnfBF0rgB42fQnZ2dnUVZ5h2dnZ2d@giganews.com> <4dfaa441$0$30002$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Thu, 16 Jun 2011 19:58:35 -0600 Subject: Re: break in a module To: Erik Max Francis Content-Type: text/plain; charset=ISO-8859-1 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: 26 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308275948 news.xs4all.nl 49042 [::ffff:82.94.164.166]:55008 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7791 On Thu, Jun 16, 2011 at 7:21 PM, Erik Max Francis wrote: >> This would, if I understand imports correctly, have ham() operate in >> one namespace and spam() in another. Depending on what's being done, >> that could be quite harmless, or it could be annoying (no sharing >> module-level constants, etc). > > No, he's using `from ... import *`. =A0It dumps it all in the same namesp= ace > (which is usually why it's frowned upon, but in his example it's kind of = the > point). The functions are defined in two separate global namespaces, though. That means that the actual bindings visible to ham() are different from the globals visible to spam(). Constants should be fine, but if ham() modifies a global, then spam() won't see the change, and vice-versa. > Neither makes sense. =A0`break` exits out of looping structures, which th= e > top-level code of a module most certainly is not. Why does that matter? It seems a bit like arguing that the `in` keyword can't be used for membership testing, because it's already in use in the for-loop syntax. It wouldn't be the first time Python has reused a keyword.