[Python-checkins] r42283 - sandbox/trunk/emailpkg/3.1/email/__init__.py
Barry Warsaw
barry at python.org
Thu Feb 9 06:13:31 CET 2006
On Feb 8, 2006, at 11:21 PM, fred.drake wrote:
> Author: fred.drake
> Date: Thu Feb 9 05:21:35 2006
> New Revision: 42283
>
> Modified:
> sandbox/trunk/emailpkg/3.1/email/__init__.py
> Log:
> be a little lazier than before
>
> Modified: sandbox/trunk/emailpkg/3.1/email/__init__.py
> ======================================================================
> ========
> --- sandbox/trunk/emailpkg/3.1/email/__init__.py (original)
> +++ sandbox/trunk/emailpkg/3.1/email/__init__.py Thu Feb 9
> 05:21:35 2006
> @@ -73,11 +73,11 @@
>
> class LazyImporter(object):
> def __init__(self, module_name):
> - self.__module_name = 'email.' + module_name
> + self.__name__ = 'email.' + module_name
>
> def __getattr__(self, name):
> - __import__(self.__module_name)
> - mod = sys.modules[self.__module_name]
> + __import__(self.__name__)
> + mod = sys.modules[self.__name__]
> self.__dict__.update(mod.__dict__)
> return getattr(mod, name)
Nice!
-Barry
More information about the Python-checkins
mailing list