Re: [Tutor] Tuple indexing

2015-03-12 Thread Ian D
. > To: tutor@python.org > From: __pete...@web.de > Date: Wed, 11 Mar 2015 16:35:09 +0100 > Subject: Re: [Tutor] Tuple indexing > > Ian D wrote: > >> Hi >> >> >> >> I have seen some examples that seem to use a tuple with a method called >

Re: [Tutor] Tuple indexing

2015-03-11 Thread Steven D'Aprano
On Wed, Mar 11, 2015 at 02:08:18PM +, Ian D wrote: [...] > I then read that a Tuple has no attribute index on this site > http://www.diveintopython.net/native_data_types/tuples.html That's pretty old, and written by an independent author. The official documentation for Python is here: https

Re: [Tutor] Tuple indexing

2015-03-11 Thread Peter Otten
Ian D wrote: > Hi > > > > I have seen some examples that seem to use a tuple with a method called > index() > > > The original code I was looking at had this sort of thing: > > > Hi Ian! Please don't use that much whitespace. It makes your post hard and unpleasant to read. Thank you. >

Re: [Tutor] Tuple indexing

2015-03-11 Thread Joel Goldstick
On Wed, Mar 11, 2015 at 10:08 AM, Ian D wrote: > Hi > > > > I have seen some examples that seem to use a tuple with a method called > index() > > > The original code I was looking at had this sort of thing: > > > > SENSORS = ('sensor1', 'sensor2') > > > SENSORS[0] > pin_index

[Tutor] Tuple indexing

2015-03-11 Thread Ian D
Hi I have seen some examples that seem to use a tuple with a method called index() The original code I was looking at had this sort of thing: SENSORS = ('sensor1', 'sensor2') pin_index = SENSORS.index("sensor1") so the result is that pin_index the is equal to 0 I the