Sam Lai added the comment: I have a more realistic example of this bug. In the docstring for distutils.LooseVersion, it says '1.5.1' and '3.2.p10' are both valid version numbers. If instead of '3.2.p10', we use '1.5.p10', the following occurs -
>>> v1 = LooseVersion('1.5.1') >>> v2 = LooseVersion('1.5.p10') >>> v1>v2 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python33\Lib\distutils\version.py", line 70, in __gt__ c = self._cmp(other) File "C:\Python33\Lib\distutils\version.py", line 343, in _cmp if self.version < other.version: TypeError: unorderable types: int() < str() >>> v1.version [1, 5, 1] >>> v2.version [1, 5, 'p', 10] The reason it occurs is pretty clear when the .version list is printed. (That's also explains why I had to use 1.5.p10 instead because otherwise the comparison would not proceed past the first element of both lists.) In my real-life example, I'm trying to compare '1.1.0-3' and '1.1.0-beta-10'. >>> v3=LooseVersion(ll[0]) >>> v4=LooseVersion(ll[1]) >>> v3>v4 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python33\Lib\distutils\version.py", line 70, in __gt__ c = self._cmp(other) File "C:\Python33\Lib\distutils\version.py", line 343, in _cmp if self.version < other.version: TypeError: unorderable types: int() < str() >>> v3.version [1, 1, 0, '-', 3] >>> v4.version [1, 1, 0, '-', 'beta', '-', 10] ---------- nosy: +samuel.lai _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14894> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com