Message119

Author bckfnn
Recipients
Date 2000-11-18.19:24:21
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
A small difference between JPython 1.1b4 and CPython 1.5.2. In CPython a package
initialization can change its own slot in sys.modules. This allow
pkg\__init__.py to controll what will be returned by a "import pkg". In JPython
"import pkg" always return the PyModule containing the pkg.__init__.

PMW uses this trick to return a specifik version of of the PMW toolkit.


------------------ FILE: test173.py ------------------ 

import test173p
print test173p

------------------ END ------------------ 

------------------ FILE: test173p\__init__.py ------------------ 

import sys 
sys.modules['test173p'] = sys

------------------ END ------------------ 


Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import test173
<module 'sys' (built-in)>
>>>


JPython 1.1beta4 on java1.3beta (JIT: null)
Copyright (C) 1997-1999 Corporation for National Research Initiatives
>>> import test173
<module test173p at 2864404>
>>>
History
Date User Action Args
2008-02-20 17:16:41adminlinkissue222836 messages
2008-02-20 17:16:41admincreate