Version Number Comparison Function

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Fri Mar 25 10:53:46 EST 2005


On 25 Mar 2005 07:34:38 -0800, rumours say that "Keith"
<vetter at lincom-asg.com> might have written:

>Is there a function for comparing version numbers?
>
>E.g.
>
>0.1.0 < 0.1.2
>1.876b < 1.876c
>3.2.2 < 3.4
>
>Keith

Convert your version numbers into tuples:

(0, 1, 0) < (0, 1, 2)
(1, 876, 'b') < (1, 876, 'c')
(3, 2, 2) < (3, 4)

All of the above are True.
-- 
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually...



More information about the Python-list mailing list