how can get the module global symbol table from a function or method which it is called?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ygao

    #1

    how can get the module global symbol table from a function or method which it is called?

    when a function or method is called,how can get the module global
    symbol table from which
    it is called,not the module where it is defined(this is easy).
    thanks!

  • ygao

    #2
    Re: how can get the module global symbol table from a function or method which it is called?

    I mean the way not passing parameter to the fonction or the method.

    ygao wrote:[color=blue]
    > when a function or method is called,how can get the module global
    > symbol table from which
    > it is called,not the module where it is defined(this is easy).
    > thanks![/color]

    Comment

    • Alex Martelli

      #3
      Re: how can get the module global symbol table from a function or method which it is called?

      ygao <ygao2004@gmail .com> wrote:
      [color=blue]
      > when a function or method is called,how can get the module global
      > symbol table from which
      > it is called,not the module where it is defined(this is easy).
      > thanks![/color]

      You can play with module inspect, or sys._getframe, but they're meant
      essentially for *debugging* purposes -- if what you have in mind is not
      related to debugging, but rather some hack to design a highly unPythonic
      API, I earnestly urge you to reconsider your design intent.


      Alex

      Comment

      Working...