10 Dec
1998
10 Dec
'98
2:31 p.m.
Here is some sample code for version numbering, a-la-GJS. # # version numbering test code # samples = [ '1.5.1', '1.5.2b2', '161', '3.10a', '8.02', '3.4j', '1996.07.12', '3.2.pl0', '3.1.1.6', '2g6', '11g', '0.960923', '2.2beta29', '1.13++', '5.5.kw', '2.0b1pl0', ] import re r = re.compile('([0-9]+|[a-z]+|\.)') def removeall(l, v): while 1: try: l.remove(v) except ValueError: return def vsn(s): comps = r.split(s) removeall(comps, '.') removeall(comps, '') for i in range(len(comps)): try: comps[i] = int(comps[i]) except ValueError: pass return tuple(comps) for s in samples: print vsn(s) -- Greg Stein, http://www.lyra.org/