[Python-Dev] python package

M.-A. Lemburg mal@lemburg.com
Sun, 14 Jul 2002 16:32:09 +0200


Gordon McMillan wrote:
> Marc-Andre,
> 
> In this thread you have posted:
> 
> 
>>python.py:
>>__path__ = ['.']
> 
> 
> and
> 
> 
>>def _redirect(mx_subpackage):
>>    global __path__
>>    import os,mx
>>    __path__ = \
>> [os.path.join(mx.__path__[0],mx_subpackage)]
> 
> 
> and
> 
> 
>>testmodload.py:
>>import sys, os
>>sys.modules['testmodload'] = os
> 
> 
> None of these will freeze successfully.

Hmm, then how do you freeze _xmlplue ?

> Two of them appear to rely on an implementation
> detail - that __path__ (only defined for
> imp.PKG_DIRECTORY's) will be followed even in
> a plain module.

AFAIK, that's not an implementation detail, but a documented
way of finding out whether a module is a package or not.

> The third is exactly what _xmlplus does, and
> consensus appears to be that that was a 
> mistake.
> 
> "Clever" does not mean "good".

But it works (tm) :-)

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/