Re: signed vs unsigned int

2010-06-04 Thread John Nagle
johnty wrote: i'm reading bytes from a serial port, and storing it into an array. Try reading into a type "bytearray". That's the proper data type for raw bytes. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: signed vs unsigned int

2010-06-04 Thread Patrick Maupin
On Jun 2, 6:25 am, John Machin wrote: > On Jun 2, 4:43 pm, johnty wrote: > > > i'm reading bytes from a serial port, and storing it into an array. > > > each byte represents a signed 8-bit int. > > > currently, the code i'm looking at converts them to an unsigned int by > > doing ord(array[i]). h

Re: signed vs unsigned int

2010-06-02 Thread John Machin
On Jun 2, 4:43 pm, johnty wrote: > i'm reading bytes from a serial port, and storing it into an array. > > each byte represents a signed 8-bit int. > > currently, the code i'm looking at converts them to an unsigned int by > doing ord(array[i]). however, what i'd like is to get the _signed_ > inte

Re: signed vs unsigned int

2010-06-02 Thread johnty
On Jun 2, 12:04 am, Christian Heimes wrote: > > i'm reading bytes from a serial port, and storing it into an array. > > > each byte represents a signed 8-bit int. > > > currently, the code i'm looking at converts them to an unsigned int by > > doing ord(array[i]). however, what i'd like is to get

Re: signed vs unsigned int

2010-06-02 Thread Christian Heimes
> i'm reading bytes from a serial port, and storing it into an array. > > each byte represents a signed 8-bit int. > > currently, the code i'm looking at converts them to an unsigned int by > doing ord(array[i]). however, what i'd like is to get the _signed_ > integer value. whats the easiest way

Re: signed vs unsigned int

2010-06-02 Thread Steven D'Aprano
On Tue, 01 Jun 2010 23:43:33 -0700, johnty wrote: > i'm reading bytes from a serial port, and storing it into an array. An array or a list? > each byte represents a signed 8-bit int. > > currently, the code i'm looking at converts them to an unsigned int by > doing ord(array[i]). however, what

Re: signed vs unsigned int

2010-06-02 Thread Stefan Behnel
johnty, 02.06.2010 08:43: i'm reading bytes from a serial port, and storing it into an array. each byte represents a signed 8-bit int. currently, the code i'm looking at converts them to an unsigned int by doing ord(array[i]). however, what i'd like is to get the _signed_ integer value. whats t

signed vs unsigned int

2010-06-01 Thread johnty
i'm reading bytes from a serial port, and storing it into an array. each byte represents a signed 8-bit int. currently, the code i'm looking at converts them to an unsigned int by doing ord(array[i]). however, what i'd like is to get the _signed_ integer value. whats the easiest way to do this?