[Python-Dev] version compare function into main lib

anatoly techtonik techtonik at gmail.com
Fri Mar 27 08:42:56 CET 2009


Correct me if I wrong, but shouldn't Python include function for
version comparisons?

The problem of splitting a string like "10.3.40-beta" into tuple for
cmp() seems to be dead simple, but the code gets bulky with excepting
errors arised from converting resulting strings for arithmetic
comparison. No wonder people advise to use ready distutils.version
module, but that's not good to introduce such dependency for main
program logic.

What do you think about adding cmpversions(first, second,
strict=false) based on distutils into main lib?
Will it be more appropriate to isolate the function into "versions" module?
Should it be rewritten to remove re dependency in this case?

Distutils version comparisons:

--anatoly t.

More information about the Python-Dev mailing list