Re: signed vs unsigned int

2010-06-04 Thread Patrick Maupin
On Jun 2, 6:25 am, John Machin sjmac...@lexicon.net wrote: On Jun 2, 4:43 pm, johnty johntyw...@gmail.com 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

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

signed vs unsigned int

2010-06-02 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?

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

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 i'd

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 to do

Re: signed vs unsigned int

2010-06-02 Thread johnty
On Jun 2, 12:04 am, Christian Heimes li...@cheimes.de 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

Re: signed vs unsigned int

2010-06-02 Thread John Machin
On Jun 2, 4:43 pm, johnty johntyw...@gmail.com 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