Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> Of course, there is also the confusion between "type cast" and "type
> conversion" -- at least, for me...
> cast taking the bit-pattern of a value in one "type" and
> interpreting the same bit-pattern as if it were a different "type"
SpreadTooThin wrote:
> Robert Kern wrote:
> > [EMAIL PROTECTED] wrote:
> > > To your question on casting long to short. This is how:
> > > a=1234L # long
> > > b=int(a) # int (short)
> >
> > No, a Python int is a C long. A Python long is an arbitrary-precision
> > number and
> > does no
SpreadTooThin wrote:
> Robert Kern wrote:
>> [EMAIL PROTECTED] wrote:
>>> To your question on casting long to short. This is how:
>>> a=1234L # long
>>> b=int(a) # int (short)
>> No, a Python int is a C long. A Python long is an arbitrary-precision number
>> and
>> does not correspond to
Robert Kern wrote:
> [EMAIL PROTECTED] wrote:
> > To your question on casting long to short. This is how:
> > a=1234L # long
> > b=int(a) # int (short)
>
> No, a Python int is a C long. A Python long is an arbitrary-precision number
> and
> does not correspond to any C type.
>
> --
So
[EMAIL PROTECTED] wrote:
> To your question on casting long to short. This is how:
> a=1234L # long
> b=int(a) # int (short)
No, a Python int is a C long. A Python long is an arbitrary-precision number
and
does not correspond to any C type.
--
Robert Kern
"I have come to believe tha
To your question on casting long to short. This is how:
a=1234L # long
b=int(a) # int (short)
John Machin skrev:
> SpreadTooThin wrote:
> > Basically I think the problem is in converting from a 32 bit integer to
> > a 16 bit integer.
> >
> > I have two arrays:
> > import array
> >
> > a
SpreadTooThin wrote:
> Basically I think the problem is in converting from a 32 bit integer to
> a 16 bit integer.
>
> I have two arrays:
> import array
>
> a = array.array('L', [65537])
> b = array.array('H', [0])
>
> b[0] = a[0]
>
> Which gives an overflow message
As it should.
> So can't
SpreadTooThin wrote:
> Basically I think the problem is in converting from a 32 bit integer to
> a 16 bit integer.
>
> I have two arrays:
> import array
>
> a = array.array('L', [65537])
> b = array.array('H', [0])
>
> b[0] = a[0]
>
> Which gives an overflow message
> So can't I truncate th