Re: string formatter %x and a class instance with __int__ or __long__ cannot handle long

2007-06-20 Thread Gabriel Genellina
En Thu, 21 Jun 2007 00:24:28 -0300, Kenji Noguchi <[EMAIL PROTECTED]> escribió: > Example2 -- pass an instance of a class with __int__() class X: > ... def __init__(self, v): > ... self.v = v > ... def __int__(self): > ... return self.v > ... y = X(0x8000) >

Re: string formatter %x and a class instance with __int__ or __long__ cannot handle long

2007-06-20 Thread half . italian
On Jun 20, 8:24 pm, "Kenji Noguchi" <[EMAIL PROTECTED]> wrote: > Hi > > I'm using Python 2.4.4 on 32bit x86 Linux. I have a problem with printing > hex string for a value larger than 0x8 when the value is given to > % operator via an instance of a class with __int__(). If I pass a long va

string formatter %x and a class instance with __int__ or __long__ cannot handle long

2007-06-20 Thread Kenji Noguchi
Hi I'm using Python 2.4.4 on 32bit x86 Linux. I have a problem with printing hex string for a value larger than 0x8 when the value is given to % operator via an instance of a class with __int__(). If I pass a long value to % operator it works just fine. Example1 -- pass a long value dir