Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:module': 0.04; 'defines': 0.07; 'mvc': 0.07; 'names.': 0.07; 'python': 0.08; 'dict': 0.09; 'wrote:': 0.15; 'attribute,': 0.16; 'subject:global': 0.16; 'underscore.': 0.16; 'cc:addr:python- list': 0.16; 'mon,': 0.16; 'pm,': 0.16; 'cheers,': 0.19; 'otherwise,': 0.19; 'cc:2**0': 0.21; 'detect': 0.22; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'module,': 0.23; "i'm": 0.27; 'framework': 0.28; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.30; 'module': 0.30; 'members?': 0.30; 'does': 0.32; 'actually': 0.33; 'it?': 0.34; 'then.': 0.35; 'johnson': 0.35; 'sequence': 0.37; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85.161': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'think': 0.38; 'data': 0.39; 'itself.': 0.39; 'received:209': 0.40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=wdRlUyEQrWM9WtMpOhZq0cdVKjk5iIDZ61muRb69vpU=; b=w0H8YMLK07YNDhhgo7o3PDf1o4qkiYFrapSdkVysATfeHYAiC3bHe3LYQq6AB/a8Rp cBCpg0Y21X72jiACdFg6vwVLIGveVOGx37qi5R5+asmd4qyqip61pNuk8XROEVAtokLC hpdSreto+G4+fFhWmYNZDehra1Sj/OxPEqyRk= MIME-Version: 1.0 In-Reply-To: <20110705000131.GN1971@johnsons-web.com> References: <3dc7e7a8-9a90-499a-b544-bb9969d9ab55@t5g2000yqj.googlegroups.com> <4e124916$0$29970$c3e8da3$5496439d@news.astraweb.com> <4e124db1$0$29973$c3e8da3$5496439d@news.astraweb.com> <20110705000131.GN1971@johnsons-web.com> From: Ian Kelly Date: Mon, 4 Jul 2011 22:28:42 -0600 Subject: Re: Testing if a global is defined in a module To: Tim Johnson 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1309840154 news.xs4all.nl 21874 [2001:888:2000:d::a6]:59664 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8811 On Mon, Jul 4, 2011 at 6:01 PM, Tim Johnson wrote: >> Yes, but what are you actually *trying to do*? "Detecting data members" = is >> not an end in itself. Why do you think you need to detect data members? > > =A0Steven, I'm building a documentation system. I have my own MVC framewo= rk > =A0and the goal is to have a documentation module for each project. It sounds like what you really want is to detect the names *exported* by the module, then. Why not do it the same way Python does it? If the module defines an "__all__" attribute, then it is taken to be a sequence of strings which are the exported names. Otherwise, the exported names are taken to be all the names in the module dict that don't begin with an underscore. Cheers, Ian