Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8795

Re: Testing if a global is defined in a module

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <tim@johnsons-web.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:module': 0.04; 'foo': 0.09; "module's": 0.09; 'received:64.4': 0.09; 'defined': 0.14; 'refactored': 0.16; 'subject:global': 0.16; 'header:In- Reply-To:1': 0.22; 'here?': 0.23; 'module,': 0.23; "i'm": 0.27; 'import': 0.29; 'anyway.': 0.29; 'thanks': 0.31; "won't": 0.32; 'chris': 0.32; 'to:addr:python-list': 0.34; 'header:User-Agent:1': 0.34; 'module.': 0.35; 'charset:us-ascii': 0.36; 'but': 0.37; 'using': 0.37; 'subject:: ': 0.38; 'else': 0.38; 'should': 0.39; 'to:addr:python.org': 0.39; 'exclude': 0.77
Date Mon, 4 Jul 2011 13:39:36 -0800
From Tim Johnson <tim@johnsons-web.com>
To python-list@python.org
Subject Re: Testing if a global is defined in a module
References <20110704181133.GH1971@johnsons-web.com> <CAMZYqRSk-dbnpesh6uMYNZ3bDSs9=hTtjQ8fzsn1x-bhQ_=dAg@mail.gmail.com>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <CAMZYqRSk-dbnpesh6uMYNZ3bDSs9=hTtjQ8fzsn1x-bhQ_=dAg@mail.gmail.com>
Organization AkWebsoft
User-Agent Mutt/1.5.20 (2009-06-14)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.608.1309815451.1164.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1309815451 news.xs4all.nl 21780 [2001:888:2000:d::a6]:37601
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8795

Show key headers only | View raw


* Chris Rebert <clp2@rebertia.com> [110704 13:16]:
> >
> > What else can I do here?
> 
> Look at the names in the module's import statements using the `ast`
> module, and exclude those from the set of names defined in the module.
> Won't work for `from foo import *`, but that's bad practice and should
> be refactored anyway.
  I'm completely new to the `ast' module, so I will have to research
  that one. 
  Thanks for the tip
-- 
Tim 
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Testing if a global is defined in a module Tim Johnson <tim@johnsons-web.com> - 2011-07-04 13:39 -0800

csiph-web