On Thu, 02 Aug 2012, Stefan Behnel wrote: > > just a side-note -- I didn't know that StrictVersion doesn't play nicely > > with LooseVersion to any degree:
> > $> python -c 'from distutils.version import LooseVersion as LV, > > StrictVersion as SV; print SV("0.17") > LV("0.18")' > > True > > at least in python3 it pukes: > > $> python3 -c 'from distutils.version import LooseVersion as LV, > > StrictVersion as SV; print(SV("0.17") > LV("0.18"))' > > Traceback (most recent call last): > > File "<string>", line 1, in <module> > > File "/usr/lib/python3.2/distutils/version.py", line 70, in __gt__ > > c = self._cmp(other) > > File "/usr/lib/python3.2/distutils/version.py", line 179, in _cmp > > if self.version < other.version: > > TypeError: unorderable types: tuple() < list() > That's surprising at first sight, but I don't think it hurts all that much. > People would normally use either of them, not both. I understand that but absence of error in python2.x case (thus suggesting supporting such a comparison) is misleading at least > Anyway, the next release candidate of Cython will be called 0.17c1. Both > the LooseVersion and the NormalizedVersion should be able to handle that. not quite: 1. $> python -c 'from distutils.version import LooseVersion as LV, StrictVersion as SV; print(SV("0.17") > SV("0.17c1"))' Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python2.7/distutils/version.py", line 40, in __init__ self.parse(vstring) File "/usr/lib/python2.7/distutils/version.py", line 107, in parse raise ValueError, "invalid version number '%s'" % vstring ValueError: invalid version number '0.17c1' so it needs to be 0.17b1 I guess $> python -c 'from distutils.version import LooseVersion as LV, StrictVersion as SV; print(SV("0.17") > SV("0.17b1"))' True 2. LooseVersion is too loose to be used with standardized suffixes, so it would not sort those release candidates appropriately $> python -c 'from distutils.version import LooseVersion as LV, StrictVersion as SV; print(LV("0.17") > LV("0.17b1"))' False -- Yaroslav O. Halchenko Postdoctoral Fellow, Department of Psychological and Brain Sciences Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755 Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419 WWW: http://www.linkedin.com/in/yarik _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel