Is there an elegant way to dir() module from inside?

2006-08-24 Thread volcano
I am looking for a way to discover which classes a module contains from
inside. I am building a testing class that should, when instatntiated
within any module, locate certain classes within the containing module.
Words of wisdom? Anybody?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there an elegant way to dir() module from inside?

2006-08-24 Thread davelist

On Aug 24, 2006, at 10:18 AM, volcano wrote:

 I am looking for a way to discover which classes a module contains  
 from
 inside. I am building a testing class that should, when  
 instatntiated
 within any module, locate certain classes within the containing  
 module.
 Words of wisdom? Anybody?


Check out the inspect module.

http://docs.python.org/lib/module-inspect.html

Dave

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there an elegant way to dir() module from inside?

2006-08-24 Thread Sion Arrowsmith
volcano [EMAIL PROTECTED] wrote:
I am looking for a way to discover which classes a module contains from
inside. I am building a testing class that should, when instatntiated
within any module, locate certain classes within the containing module.

globals().keys()

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
  ___  |  Frankly I have no feelings towards penguins one way or the other
  \X/  |-- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Is there an elegant way to dir() module from inside?

2006-08-24 Thread volcano

Sion Arrowsmith wrote:
 volcano [EMAIL PROTECTED] wrote:
 I am looking for a way to discover which classes a module contains from
 inside. I am building a testing class that should, when instatntiated
 within any module, locate certain classes within the containing module.

 globals().keys()

 --
 \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
   ___  |  Frankly I have no feelings towards penguins one way or the other
   \X/  |-- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump

thanks, it worked!

-- 
http://mail.python.org/mailman/listinfo/python-list