Guido van Rossum wrote: > > > AFAIK, __version__ with a string value is in common usage both > > in modules and classes. > > Correct. This was agreed upon as a standard long ago. It's probably > not documented anywhere as such. Probably should be... along with some other __special_name__ which are in use, e.g. __copyright__ or __author__. I think it would be a good idea to add these attribute names as virtually "reserved" attribute names. > > BTW, while we're at it: with the growing number of dependencies > > between modules, packages and the Python lib version... how about > > creating a standard to enable versioning in module/package imports ? > > > > It would have to meet (at least) these requirements: > > > > * import of a specific version > > > > * alias of the unversioned name to the most recent version > > available > > > > Thoughts ? > > This is a major rathole. I don't know of any other language or system > that has solved this in a satisfactory way. Most shared library > implementations have had to deal with this, but it's generally a very > painful manual process to ensure compatibility. I would rather stay > out of trying to solve this for Python in a generic way -- when > specific package develop incompatible versions, it's up to the package > authors to come up with a backwards compatibility strategy. Well, I think it should at least be possible to install multiple versions of the same packages in some way which makes it possible for other programs to choose which version to take. With packages and the default import mechanism this is possible using some caching and __path__ trickery -- I think Pmw does this. The new "from ... import ... as" also provides ways for this: from mx import DateTime160 as DateTime The problem with the latter approach is that pickles will use the versioned name and thus won't port easily to later versions. But you're probably right: only the package itself will know if it's ok to use the newer version or not. Would still be nice if we had some kind of documented naming scheme for versioned modules and packages though, so that the user will at least recognize these as being versioned import names. -- Marc-Andre Lemburg ______________________________________________________________________ Company: http://www.egenix.com/ Consulting: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4