Hi,
I'm trying to support two Python versions at the same time and I'm trying to find effective mechanisms to support modules compiled in C++ transparently.


All my code in under a single package. Is it possible to override the import mechanism only for modules under that package and sub-packages so that?:

import cppmymodule

would be equivalent to:

if sys.version == "2.4":
    import cppmymodule24 as cppmymodule
elif sys.version == "2.3":
    import cppmymodule23 as cppmymodule

for all modules under the package and all modules with names beginning with cpp (or another way to identify them).


I have also third party packages. Is it possible to make a package point to another folder? For example:


psyco23/...
psyco24/...
psyco/__init__.py => points to psyco23 or psyco24 depending on Python version used.


Note that I cannot use .pth files or symbolic links, since I would want the exact same code hierarchy to work with both Python 2.3 and 2.4.

Any help appreciated.
Thx and regards,
Nicolas
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to