Re: [Tutor] array('c')

2014-05-01 Thread Ian D
Thanks > To: tutor@python.org > From: breamore...@yahoo.co.uk > Date: Thu, 1 May 2014 16:40:54 +0100 > Subject: Re: [Tutor] array('c') > > On 01/05/2014 15:38, Ian D wrote: > > Hi > > > > I have this part of code and am unsure as to the effect of th

Re: [Tutor] array('c')

2014-05-01 Thread Stefan Behnel
Ian D, 01.05.2014 16:38: > I have this part of code and am unsure as to the effect of the array('c') > part. The argument that you pass into the constructor is a type identifier. https://docs.python.org/2/library/array.html#array.array The different types are defined at the top of that page. I

Re: [Tutor] array('c')

2014-05-01 Thread Mark Lawrence
On 01/05/2014 15:38, Ian D wrote: Hi I have this part of code and am unsure as to the effect of the array('c') part. Is it creating an array and adding 'c' as its first value? This does not seem to be the case. Thanks n = len(cmd) a = array('c') a.append(chr((n>> 24) & 0xFF))

Re: [Tutor] array('c')

2014-05-01 Thread Peter Otten
Ian D wrote: > I have this part of code and am unsure as to the effect of the array('c') > part. Is it creating an array and adding 'c' as its first value? No, the first arg to array.array() is the typecode; data may be passed as the second argument. The typecode "c" creates an array of 8-bit ch

[Tutor] array('c')

2014-05-01 Thread Ian D
Hi I have this part of code and am unsure as to the effect of the array('c') part. Is it creating an array and adding 'c' as its first value? This does not seem to be the case. Thanks n = len(cmd) a = array('c') a.append(chr((n>> 24) & 0xFF)) a.append(chr((n>> 16) & 0