From: C A. R. <an...@ex...> - 2010-10-09 03:05:29
|
On Fri, Oct 8, 2010 at 7:47 PM, Guy K. Kloss <g....@ma...> wrote: > On Sat, 09 Oct 2010 13:11:44 Bruce Sherwood wrote: >> I think and hope we're in agreement. My point was a narrow technical >> one, that in the matplotlib case the simplified import could be >> handled with a single file (pylab.py) whereas we need a folder named >> visual due to the existence of visual.graph and visual.factorial and >> possible imports by someone of other files currently in the visual >> folder. > > Wouldn't it make sense to have "vpython" (or any other name) as a package > (folder/directory), which contains then the modules graph and factorial? I 100% agree here... and a bit of reiteration, but the clean module *must* have all the guts, "visual" becomes a "meeting ground"/facade of "vpython", numpy, etc., along with some convenience stuff. "visual" package should do nothing significant. > Then visual would just need to be a module (visual.py) to import the stuff > from vpython, vpython.graph, vpython.factorial, ... After some research I really don't think this is possible; it would only work if importing "visual" directly, ie. `import visual`. The standard import machinery directly translates the dotted package name to a directory hierarchy... the only way I see around this is by using sys.meta_path, or possibly some tweaking from a C module, but the latter is beyond my knowledge. So, it may have to remain a package for compatibility, but that doesn't mean it needs to implement anything significant; it can still import what it needs from "vpython". C Anthony |