David Boddie wrote: > On Friday 28 April 2006 01:31, Ian Bicking wrote: >> David Boddie wrote: > >>> These days it could be implemented more cleanly using the improved import >>> hook mechanism. >> You are right, that wasn't hard at all: >> http://svn.colorstudy.com/home/ianb/httpimport.py >> >> I haven't tested this seriously, and I'm not sure about the performance. >> Mmm... data loading also fits in. > > I don't think you need to worry about the performance. These are the main > problems with my implementation that I found disappointing: > > 1. There's no way to import shared library modules unless you want to > cache them on disk before loading them. Having said that, I could > probably think of some possible workarounds. Ideally, for low level > stuff that needed these, you'd have a selection of different versions > for different operating systems and architectures on the server, and > the import hook would request the relevant one behind the scenes.
I was thinking about it mostly for "user" code, which would be pure Python. And the subversion idea also appeals to me. > 2. The help command didn't work properly, making it less useful for > interactive use. Phillip Eby fixed this for Python 2.5 -- not necessarily for my hook, but at least making it possible. I don't know if it's easily backported or not. If not, that would be a real problem. (Tracebacks also don't work nicely) > In the end, an enhanced interpreter/workbook application could do lots of > these extra things without needing to bend the rules of the import system. > On the other hand, it's fun to code things that make you think differently > about the language and interpreter. Yeah, I'm kind of thinking about these things in terms of HTConsole; the "save" command at this point doesn't really save a module -- though it could be a module, it doesn't really feel like one, since "load" just executes the file in the current namespace. But I dunno... this is mostly just at the playing around stage at this point. -- Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org _______________________________________________ Edu-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/edu-sig
