0

I know for Python version, you can

if sys.version_info < (2,8):
    print 'there will be no Python 2.8!'

But, is there a similar way to do this for a module?

Right now I am doing something like:

# in case like '1.8.1rc', need to filter for numbers
ver = [int(filter(lambda x : x.isdigit(), n)) for n in np.__version__.split('.')]
ver.reverse()
if sum([v * 10 ** n for n,v in enumerate(ver)]) < 181:
    print "np.unique before gh-2799: allow using unique with lists of complex"
otterb
  • 2,660
  • 2
  • 29
  • 48
  • Yes, this solved my problem. I could not believe Python does not have a solution for this. So, I did search but somehow could not find this. Thanks! – otterb May 14 '14 at 00:18
  • No one can ever seem to agree on what a 'version' should be, so that's why there is no language support for it, only conventions used by various tools like `distutils`. – aruisdante May 14 '14 at 01:18

0 Answers0