[Python-Dev] Fix import errors to have data

Jim Fulton jim at zope.com
Fri Jul 30 14:28:18 CEST 2004


Phillip J. Eby wrote:
> At 05:02 PM 7/29/04 -0400, Jim Fulton wrote:
> 
>> Guido van Rossum wrote:
>>
>>> But who ever uses __module__ for anything else than printing it?
>>
>>
>> It's crucial for pickling.
> 
> 
> Interesting point.  That means that cPickle wouldn't work in a "module 
> space" without modification.  The pure-Python pickle module would 
> unpickle into the current module space.

And that might be the wrong module space.  If one was going to introduce a
concept of module spaces, one would need to extend the pickling machinery
as well.

I'll note that Python already has module spaces. They're called "packages". :)

The problem with Python's current package system is that it's not possible,
in general, to write packages that can be moved around within the package
system, because relative imports aren't reobust or flexible enough.
PEP 328 would fix this. PEP 328 would allow creation of packages that
worked regardless of where there were places or that worked relative
to a containing package regardless of where that was placed. You could
then have different module spaces expressed by adding a new layer of top-level
modules.  You wouldn't need any new machinery beyond PEP 328.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Python-Dev mailing list