Version Type for upgrade comparison (Re: [Zope] Was: Zope (X)3 FAQ)

Johan Carlsson [EasyPublisher] johanc@easypublisher.com
Mon, 07 Apr 2003 16:17:46 +0000


At 15:39 2003-04-07 +0200, Oliver Bleutgen said:
>Johan Carlsson [EasyPublisher] wrote:
>
>>I think it should use a float instead of a string because it would make it
>>easier to identify the occurrence of an older version than X.X.
>>Integers would work as well, but I have actually change the Easy
>>Publisher upgrade method to use a float, so float is preferred for me ;-)
>>(The integer part of the float represents the main version number and the 
>>fraction represents
>>the minor version (I know it will be difficult because of the three 
>>version standard if the second or
>>third digit become greater that 9, I have solved it by never letting them 
>>be greater that 9).
>>Floats are easier than tuples, I like it easy ;-)
>
>None Zope (X)3 related 2c:
>
>But wouldn't tuples in python be the ideal structure to store stuff like 
>version numbers?
>
> >>> version_list = [(2,), (1, 1, 2), (1, 1), (1,), (1, 19)]
> >>> version_list.sort()
> >>> verlist
>[(1,), (1, 1), (1, 1, 2), (1, 19), (2,)]

Aha. Off course!

Python is always better then I expect it to be :-)

Cheers,
Johan Carlsson



-- 
Easy Publisher Developers Team
Johan Carlsson
johanc@easypublisher.com

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Phone +46-(0)8-31 24 94
Fax +46-(0)8-675 04 44
Mobil +46-(0)70-558 25 24
http://www.easypublisher.com