PEP: import version
Manlio Perillo
NOmanlio_perilloSPAM at libero.it
Thu May 13 03:46:51 EDT 2004
Hi.
I'm a new user of Python but I have noted a little problem.
Python is a very good language but it is evolving, in particular its
library is evolving.
This can be a problem when, ad example, a module change its interface
or its implementation in a fundamental way (an example: wxPython).
This, I think, can be resolved by allowing an user to explicitly say
what version of a module it wants (sush as version numbers in Linux
shared objects).
A possible syntax is this:
import wxPython version '2.4'
When the version number is missing, the latest version is loaded.
The syntax of the version number can be expanded.
Ad example, when a module change totally its interface, instead of
renaming it, one can be do (its only an example):
import mymodule version '0'
Another case is when the module is implemented also in C:
import picke version 'C'
This new syntax can be implemented by using version numbers on the
module file name, or by introducing a new special variable at module
level: __moduleversion__
A module implementator can check against this variable:
def foo():
if __moduleversion__ < 2:
# compatibility
pass
else:
return something
(It would be better if the check can be done at module loading time)
Regards Manlio Perillo
More information about the Python-list
mailing list