Modul gotchas:)
Giorgi Lekishvili
gleki at gol.ge
Wed Jan 2 17:20:40 EST 2002
More information about the Python-list mailing list
Wed Jan 2 17:20:40 EST 2002
- Previous message (by thread): Modul gotchas:)
- Next message (by thread): Modul gotchas:)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thanx! Meanwhile, I found another solution: myModule.__dict__.keys() I guess it will produce the same result? Sylvain Thenault wrote: > On Wed, 02 Jan 2002 13:13:44 -0800, Giorgi Lekishvili <gleki at gol.ge> wrote: > >Hi all! > > > >happy new year, first of all!!! > > > >My question is simple, yet I missed the right answer, although have lots > >of books on Python:( > > > >Suppose, one has a module, which defines some set of functions. > > > >The question: > > > >How can one get the names of all these functions as list entries? > > > >E.g., > > > >all_func=[] > > > >import myModule > > > >all_func=myModule.functions() > > > >of course, this will not work. > > > >What is to be done? Some special functions are to be written or, is > >there a built-in tool? > > you can use the built-in "dir" function to do things like that. > The following code filters functions from the "dir" output: > > import myModule > for f in dir(myModule): > if callable(getattr(myModule, d)): > print d > > cheers > > -- > Sylvain Thenault > > LOGILAB http://www.logilab.org
- Previous message (by thread): Modul gotchas:)
- Next message (by thread): Modul gotchas:)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list