pickle and module package

Markus Stenberg mstenber at cc.Helsinki.FI
Tue May 18 16:16:18 EDT 1999


"Jeffrey Kunce" <kuncej at mail.conservation.state.mo.us> writes:
> >you can add init code to the modules that checks whether they have
> >already been imported by e.g. placing an entry into a dictionary
> >sys.module_registry.
> not a bad idea - except you shouldn't *have* to do that.

Seconded :P

> I'm running into problems where I have a deep hierarchy of 
> packages. Maybe I'm taking the package thing too far, but I've
> tried to put all my production code into one big hierarchy something like:
>   mycompany.applications.mysystem.mysubsystem.mymodule
>   mycompany.lib.mylibcategory.mymodule

Join the club.

> It seems to me that modules may have "relative package names" in some
> situations, but must have "absolute package names" in other situations.
> I would prefer that this be consistent, but I'd at least like to see it
> documented.

It's even more fun when you mix rexec into it; I nearly went mad trying to
figure 'what module is what module and why they're getting re-imported N
times' (from+import, import, and multiple rexec contexts)

>   --Jeff

-Markus

-- 
----- BEGIN GEEK CODE v3.0 BLOCK (*) -----
GCS d- s+: !a C+(++) UL+++$ P--- L+++ E++ W-- N+ W--- O---- M-- V- PS+++
Y+ PGP++>+++ t+@ 5++ X+ R* tv-- b+++ DI+++>++++ D---- G++ e++ h* r% z+
----- END GEEK CODE v3.0 BLOCK -----
* For spoilers, check http://www.geekcode.com




More information about the Python-list mailing list