[Python-Dev] version compare function into main lib

Eric Smith eric at trueblade.com
Fri Mar 27 17:30:35 CET 2009

Mart Sõmermaa wrote:
>     Instead of trying to parse some version string, distutils should
>     require defining the version as tuple with well-defined entries -
>     much like what we have in sys.version_info for Python.
>     The developer can then still use whatever string format s/he wants.
>     The version compare function would then work on this version tuple
>     and probably be called cmp() (at least in Python 2.x ;-).
> Except there need to be functions for parsing the tuple from a string 
> and preferably a canonical string representation to ease that parsing. 
> Hence the Version class in "Version Handling" referred to above.

Right. For example, say you need to specify in a config file that your 
package requires version 1.3.4 of some other tool. I think the only 
rational way to do this is in a string, and be able to parse the version 
number (possibly into a tuple) and compare it with other version 
numbers. I don't think you want to directly specify the tuple in such a 


More information about the Python-Dev mailing list