> I'm not saying I don't want to do that. I'm saying that, in addition to
> what you've written, I want foo to know it's being imported, and by whom.
>
You're still not explaining a real example of what this could be used for.
Oh well, here's an example of an implementation of what you want to do.
Import.py
================
#!/usr/bin/python
class Importer:
def __init__(self):
pass
def __import__(self, module):
exec "import %s" % module
exec "a = %s" % module
a.setImported(self)
i = Importer()
i.__import__("Imported")
================
Imported.py
================
#!/usr/bin/python
def setImported(importer):
print "I've been imported by %s" %importer
================
--
==================
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org
AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==================
--
http://mail.python.org/mailman/listinfo/python-list