Odd version scheme

Tim Chase python.list at tim.thechases.com
Thu Feb 12 12:46:31 EST 2015


On 2015-02-12 18:37, Gisle Vanem wrote:
> Tim Chase wrote:> So the test should actually be something like
> 
> >    if LooseVersion(QtCore.PYQT_VERSION_STR) <
> > LooseVersion("4.10"): balk()
> 
> That's exactly what they do now in IPython/utils/version.py with
> the comment:
>    Utilities for version comparison
>    It is a bit ridiculous that we need these.
> 
> Not sure why this is "ridiculous".

Well, if you're storing them as strings, then duh, you need the
helper utilities.  If you store them as comparable tuples, then it's
not a problem. :-/

  # library.VERSION = (3, 14, 15)
  if library.VERSION < (2, 3, 18):
    complain()

It does become harder to mark things as alpha/beta/pre/rc, but
something Enum-like might suffice for that in a fourth field of the
tuple.

-tkc






More information about the Python-list mailing list