[Email-SIG] PEP 8 module names for email 3.1? (original) (raw)
Barry Warsaw barry at python.org
Thu Feb 9 03:52:28 CET 2006
- Previous message: [Email-SIG] PEP 8 module names for email 3.1?
- Next message: [Email-SIG] PEP 8 module names for email 3.1?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 2006-02-08 at 16:49 -0500, Fred L. Drake, Jr. wrote:
This is a clear case for lazy imports; perhaps something like this in email/init.py:
import sys class LazyImporter(object): def init(self, modulename): _self.modulename = modulename def getattr(self, name): _import(self.modulename) _mod = sys.modules[self.modulename] self.dict.update(mod.dict) return getattr(mod, name) sys.modules["email.MIMEText"] = LazyImporter("email.mime.text") ...
That's a great start Fred, thanks!
I've now got a copy of the email package that supports both naming schemes. I've also got two copies of the test modules, one that tests the old names and one that tests the new names. The only change necessary in the old name tests was the all test (which makes sense of course).
So, rather than post patches or commit this to the Python trunk, I'm going to make a copy in the sandbox and check the changes in there. It would be great if people could check it out and let me know what you think.
I'll send an email when that's done.
-Barry
-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 307 bytes Desc: This is a digitally signed message part Url : http://mail.python.org/pipermail/email-sig/attachments/20060208/0ac4dcd1/attachment.pgp
- Previous message: [Email-SIG] PEP 8 module names for email 3.1?
- Next message: [Email-SIG] PEP 8 module names for email 3.1?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]