Testing if a global is defined in a module

Tim Johnson tim at johnsons-web.com
Tue Jul 5 17:30:30 CEST 2011


* Ian Kelly <ian.g.kelly at gmail.com> [110704 20:37]:
> 
> It sounds like what you really want is to detect the names *exported*
> by the module, then.  i
  Yes! 
> 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.

  :) Oh here we go again. Another python feature I didn't know about
  or have forgotten.

  Thanks very much for that.
  Good tip
-- 
Tim 
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com



More information about the Python-list mailing list