Hi Brian! On Tue, Feb 05, 2008 at 00:25 -0800, Brian Dorsey wrote: > I ran into this comp.lang.python post today: > http://groups.google.com/group/comp.lang.python/browse_thread/thread/5a9580e76484f73/ > > Seems like initpkg might be a good solution for the poster... however, > I didn't see any reference to initpkg in any of the docs for py lib. > Is it intended to be an implementation detail, or a tool for others to > use?
good question! i very quickly skimmed the above (huge) thread. Indeed, the goal of separating a package's namespace organisation from file locations on disk is a main motivation of py' initpkg. I am using initpkg in a couple of other projects with PKG/__init__.py containing: from py import initpkg initpkg("vadm", ... exportdefs={ ... } ) However, there indeed isn't documentation on using it. The initpkg mechanism is not using __import__ hooks but subclasses the Module Class. This also provides lazy importing facilities and greatly reduces the need for "import" lines at the header of files. It also gives good control on which names exactly are seen from package's users. IMO feel free to carefully point him to the mechanism and invite him to to try out. He may also subscribe here in order to discuss more or get support - i likely won't make it to post to c.l.py myself. best, holger _______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev