Need help with an array problem.

John Machin sjmachin at lexicon.net
Tue Oct 3 03:41:10 CEST 2006


SpreadTooThin wrote:
> Robert Kern wrote:
> > jakobsg at gmail.com 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 there is no short(number) casting?
>

It depends on what you think you mean by "short(number) casting". I
thought I'd answered your original question -- if
    short = long & 0xffff
doesn't do what you want to do, please give examples of what "long"
means to you, and what you expect the result of "short(number) casting"
each example to be.




More information about the Python-list mailing list