On Tue, 24 Jan 2006 13:23:05 -0300 in comp.lang.python, Ricardo Quesada <[EMAIL PROTECTED]> wrote:
>Hi, > > In python 2.0, this number was an integer: > 0x88776655 > > but in python 2.4 it is a long (every number > 0x7fffffff it is a long) > >in python 2.4, is there a way to convert that number to a integer >(notice that it only occupies 32 bits) ? Well, the sign bit's gonna be set no matter what. But the following might work for you... >>> def short(x): return int(0x80000000 - x) >>> x = short(0x88776655) >>> x -142042709 >>> "%x"%x '-8776655' >>> Regards, -=Dave -- Change is inevitable, progress is not. -- http://mail.python.org/mailman/listinfo/python-list