[Python-ideas] Add support for version objects

Serhiy Storchaka storchaka at gmail.com
Sat May 28 03:55:16 EDT 2016

On 27.05.16 22:30, Oleg Broytman wrote:
>     Something like
> https://hg.python.org/cpython/file/tip/Lib/distutils/version.py
> https://hg.python.org/cpython/file/tip/Lib/distutils/versionpredicate.py
>     ???

Thank you. I was not aware of this class when wrote my message. This 
class provide a part of the feature. It doesn't provide nor tuple-like 
interface, nor attributes like major and minor, it doesn't allow to 
create a version object from components, and LooseVersion objects are 
not comparable in general case:

 >>> LooseVersion('2.2beta29') < LooseVersion('2.2.0')
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/home/serhiy/py/cpython/Lib/distutils/version.py", line 52, in 
     c = self._cmp(other)
   File "/home/serhiy/py/cpython/Lib/distutils/version.py", line 337, in 
     if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'

More information about the Python-ideas mailing list