Python Gotcha with Octal Numbers

Grant Edwards grante at visi.com
Fri Feb 22 14:01:06 EST 2002


In article <3C768454.A5F778D2 at ccvcorp.com>, Jeff Shannon wrote:

>> I just got bit by the leading-zero thing again about 10 minutes
>> ago when I changed the minor version number of something from 07
>> to 08.  Had to skip from 1.07 to 1.10...
> 
> So try using 010, which should then be converted back to 8 ... (or else keep your
> versioning info as strings.)

[The recent issue was in a C program.]

The major and minor version info is defined in a header file:

#define MAJOR_VERSION 1
#define MINOR_VERSION 08

In some places it's "stringified" and concatenated using
preprocessor tricks, and other places it's used as an integer
literal constant.  Perhaps the design is a bit baroque, but
it's easier to skip from 07 to 10 than it is to change the
usage in multiple places.

-- 
Grant Edwards                   grante             Yow!  Where's SANDY DUNCAN?
                                  at               
                               visi.com            



More information about the Python-list mailing list