name of client module

Nick Stinemates nick at stinemates.org
Mon Feb 18 21:16:03 EST 2008


Jeff Schwab wrote:
> Q1: When a module is imported, is there any way for the module to 
> determine the name of the client code's module?
>   
Why would you ever want to do this?
> Q2: My understanding is that the code in a module is executed only on 
> the first import of that module.  Is there any way to have a hook 
> invoked on subsequent imports, and for that hook (as in Q1) to determine 
> the name of the client module?
>   
Why would you ever want to do this?

I don't really understand why you wouldn't want to do the following:

import foo
foo.exec()



-- 
==================
Nick Stinemates (nick at stinemates.org)
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: nickstinemates at hotmail.com
Yahoo: nickstinemates at yahoo.com
==================





More information about the Python-list mailing list