Re: accessing elements of a tuple

2009-02-01 Thread Steven D'Aprano
On Sun, 01 Feb 2009 09:32:42 -0500, D'Arcy J.M. Cain wrote: > On Sun, 01 Feb 2009 19:23:58 +1100 > Steven D'Aprano wrote: >> D'Arcy J.M. Cain wrote: >> >> > First of all, list is a reserved word.  Don't use it as a variable >> > name. >> >> Unless you mean to. Shadowing built-ins is only a bad

Re: accessing elements of a tuple

2009-02-01 Thread D'Arcy J.M. Cain
On Sun, 01 Feb 2009 19:23:58 +1100 Steven D'Aprano wrote: > D'Arcy J.M. Cain wrote: > > > First of all, list is a reserved word.  Don't use it as a variable name. > > Unless you mean to. Shadowing built-ins is only a bad thing when you do it > by accident. I suppose but I am having a hard time

Re: accessing elements of a tuple

2009-02-01 Thread Steve Holden
Steven D'Aprano wrote: > D'Arcy J.M. Cain wrote: > >> First of all, list is a reserved word. Don't use it as a variable name. > > Unless you mean to. Shadowing built-ins is only a bad thing when you do it > by accident. > Quite. And we should observe that "list" is not a reserved word in the se

Re: accessing elements of a tuple

2009-02-01 Thread Steven D'Aprano
D'Arcy J.M. Cain wrote: > First of all, list is a reserved word.  Don't use it as a variable name. Unless you mean to. Shadowing built-ins is only a bad thing when you do it by accident. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: accessing elements of a tuple

2009-01-30 Thread John Machin
On Jan 31, 9:42 am, Matthew Sacks wrote: > >First of all, list is a reserved word.  Don't use it as a variable name. > > I was using it as an example in this case. > > >mylist[0][1] if I understand the question. > > This works. Thank you. > > On Fri, Jan 30, 2009 at 2:39 PM, Tim Chase > > wrote:

Re: accessing elements of a tuple

2009-01-30 Thread Matthew Sacks
>First of all, list is a reserved word. Don't use it as a variable name. I was using it as an example in this case. >mylist[0][1] if I understand the question. This works. Thank you. On Fri, Jan 30, 2009 at 2:39 PM, Tim Chase wrote: >> let me re-phrase that question: >> i would like to access t

Re: accessing elements of a tuple

2009-01-30 Thread Tim Chase
let me re-phrase that question: i would like to access the element of individual tuples inside of a list, by using an index. so i have the list contents print list [('--datasourcename', 'DB'), ('--password', '123')] How can I access "DB" from the list directly using an index? right now I would

Re: accessing elements of a tuple

2009-01-30 Thread Ian Pilcher
Matthew Sacks wrote: > How can I access "DB" from the list directly using an index? list[0][1] ... or did I misunderstand your question? -- Ian Pilcher arequip...@gmail.com =

Re: accessing elements of a tuple

2009-01-30 Thread D'Arcy J.M. Cain
On Fri, 30 Jan 2009 14:23:31 -0800 Matthew Sacks wrote: > let me re-phrase that question: > i would like to access the element of individual tuples inside of a > list, by using an index. > so i have the list contents > > print list > [('--datasourcename', 'DB'), ('--password', '123')] > > How ca

Re: accessing elements of a tuple

2009-01-30 Thread Matthew Sacks
let me re-phrase that question: i would like to access the element of individual tuples inside of a list, by using an index. so i have the list contents print list [('--datasourcename', 'DB'), ('--password', '123')] How can I access "DB" from the list directly using an index? right now I would h