How to get the list of imported variables/functions

emile at fenx.com emile at fenx.com
Wed May 3 10:53:35 EDT 2000


Cool.  I got it to work.  I don't know what I was doing yesterday
though.
I'd figured on the missing 's', but must have had a typo somewhere else
in
the rest of it anyway.

Thanks,

Emile van Sebille
emile at fenx.com


Michael Hudson <mwh21 at cam.ac.uk> wrote in message
news:<m3zoq8hrpd.fsf at atrus.jesus.cam.ac.uk>...
> "Emile van Sebille" <emile at fenx.com> writes:
> 
> > Well, I got this to work:
> > 
> > a = dir(sys.modules['imported_mod'])
> > 
> > then filter as needed.
> > 
> > I couldn't get the keys attribute of the module though. Should
> > I have been able to?
> > 
> > filter(lambda s:s[1]<>'_',sys.module['imported_mod'].__dict__.keys())
> 
> Ack, surse me for a fool; I meant
> 
> filter(lambda s:s[1]<>'_',sys.modules['imported_mod'].__dict__.keys())
> 
> (I've even tested it this time!)
> 
> M.
> 
> -- 
> 8. A programming language is low level when its programs require
>    attention to the irrelevant.
>      -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html
> -- 
> http://www.python.org/mailman/listinfo/python-list
>




More information about the Python-list mailing list