Looking up caller's namespace

David Arnold arnold at dstc.monash.edu.au
Thu May 25 07:35:39 EDT 2000


-->"Yves-Eric" == Yves-Eric Martin <yemartin at garage.co.jp> writes:

  Yves-Eric> I have looked through docs and list archive, but I could
  Yves-Eric> not find the right way to do this
  Yves-Eric> "__caller's_namespace__['b']" lookup. Have I used the
  Yves-Eric> wrong keywords or is there no straightforward way to do
  Yves-Eric> that? 

one way to do this is to raise an exception, catch it, and extract
the stack frame(s) from the exc_info ...

it's slow (new exception handling context, raise, catch, etc) but i
think that the frame object has all the name spaces bound.




d




More information about the Python-list mailing list