Does python have an internal data structure with functions imported from a module?

Georg Brandl g.brandl-nospam at gmx.net
Fri Feb 17 16:26:55 EST 2006


Carl J. Van Arsdall wrote:
> Alright, I attempted to post this question yesterday but I don't see it 
> as showing up, so I apologize in advance if this is a double post.
> 
> Python Gurus:
> 
> Let me elaborate a bit more on this question.  Basically, I want to know 
> if there is some data structure in python that maps a string function 
> name to an address of a function or something to that nature.
> 
> If this is confusing, let me describe what I want to do and see if 
> anyone has any ideas.
> 
> basically we have:
> 
>  >>>def functA():
> ...  pass
> 
>  >>> functA
> <function functA at 80db128>
> 
> And what I'd like to do is:
> 
>  >>>__internalFuncDict__['functA']
> <function functA at 80db128>

Read about globals(), dir() and module.__dict__.

Georg



More information about the Python-list mailing list