On 4/23/07, Christian Heimes <[EMAIL PROTECTED]> wrote:
> Steven Bethard wrote:
> > Of course, to make it work with packages, you have to write something like::

> >     mod = __import__(__name__)
> >     for sub_mod_name in __name__.split('.')[1:]:
> >         mod = getattr(mod, sub_mod_name)

> > I guess that's not so simple after all.
> >
> > STeVe

> Do you want to do something like:

> import sys
> mod = sys.modules[__name__]
> mod = sys.modules[self.__class__.__module__]

Sure.  But I also want it to work, even if module.__name__ has been
changed, or module has been removed from sys.modules (perhaps for
security reasons), or some other module is already using that name.

That said, I won't be shocked if Guido eventually decides to support
only one or two of the magic words, just as he initially limited
decorators to functions.

-jJ
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to