package.module != module 
Author Message
 package.module != module

I have discovered that apparently python's mechanism for discovering if a
module has already been imported fails when you import a "fully qualified"
package previously imported as a sister.  i.e.: ("import package.sister")
package/ ("class B: pass") ("""
import sys
import sister, client
print repr(sister.B), repr(client.package.sister.B)
print sys.modules.keys()

We find that sister.B and client.package.sister.B are different classes.  The
reason why appears to be sys.modules: we have both 'package.sister' and
'sister' imported as seperate modules.

I get this convoluted structure all the time in ZPublisher (Zope), and when I
want to talk about a class defined in a package from a module run by that
package, nothing works because the package has different versions of the same
classes I'm talking about in my modules.  You can't catch exceptions defined
in the package and thrown from a client module.

Feature?  Quirk?  Workaround?  Help!  :)


Wed, 10 Oct 2001 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Puzzling difference between module and package.module

2. Module Packages - package-search-strategy controversy

3. modules what modules

4. Module information in load-module

5. including modules => installing modules

6. Module for showRE and other modules, generally?

7. New list: ruby-modules - for module developers...

8. Module#include and module/class methods

9. Local Modules and Module Priority

10. local modules and module

11. Passing module instance names to modules

12. Help Linking Assembly Modules with C Modules


Powered by phpBB® Forum Software