Testing if a global is defined in a module

Tim Johnson tim at johnsons-web.com
Mon Jul 4 17:39:36 EDT 2011


* Chris Rebert <clp2 at 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



More information about the Python-list mailing list