Does python have an internal list/dictionary of functions?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Carl J. Van Arsdall

    #1

    Does python have an internal list/dictionary of functions?

    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:
    [color=blue][color=green][color=darkred]
    >>>def functA():[/color][/color][/color]
    .... pass
    [color=blue][color=green][color=darkred]
    >>> functA[/color][/color][/color]
    <function functA at 80db128>

    And what I'd like to do is:
    [color=blue][color=green][color=darkred]
    >>>__internalFu ncDict__['functA'][/color][/color][/color]
    <function functA at 80db128>

    This is just for a little experimental project of mine, any help or
    pointers to the proper pages in the manual would be greatly
    appreciated. Basically, I know that I can create something like this if
    I have to but I was very much hoping that something already existed
    somewhere that I could get to via python or by writing a C extension.

    Thanks in advance!

    -carl


    --

    Carl J. Van Arsdall
    cvanarsdall@mvi sta.com
    Build and Release
    MontaVista Software

  • Raymond Hettinger

    #2
    Re: Does python have an internal list/dictionary of functions?

    [Carl J. Van Arsdall][color=blue]
    > basically we have:
    >[color=green][color=darkred]
    > >>>def functA():[/color][/color]
    > ... pass
    >[color=green][color=darkred]
    > >>> functA[/color][/color]
    > <function functA at 80db128>
    >
    > And what I'd like to do is:
    >[color=green][color=darkred]
    > >>>__internalFu ncDict__['functA'][/color][/color]
    > <function functA at 80db128>[/color]

    globals()['functA']

    Comment

    Working...