Johannes Janssen wrote:
 > class A(object):
 >     def __init__(self, mod=__name__):
 >         self.mod = mod

.... won't work. In this case mod would always be "foo".

You have to inspect the stack in order to get the module of the caller. The implementation of warnings.warn() gives you some examples how to get the module name.

Christian
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to