Re: tuple versus list

2005-10-17 Thread Bryan
>> >>i always use the structure analogy. if you view (width, height) as a >>structure, >>use a tuple. if you view it a sequence, use a list. in this example, i view >>it >>as a stucture, so i would use (width, height) as a tuple. > > > Right, but there's an unfortunate ambiguity in the te

Re: tuple versus list

2005-10-17 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Bryan <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > In this particular case, it seems that (width,height) looks nicer. But > > I think otherwise, list constuct is easier to read, even though it is > > supposed to be slower. > > > > With list you can :

Re: tuple versus list

2005-10-16 Thread Bryan
[EMAIL PROTECTED] wrote: > In this particular case, it seems that (width,height) looks nicer. But > I think otherwise, list constuct is easier to read, even though it is > supposed to be slower. > > With list you can : > [a] + [ x for x in something ] > > With tuple it looks like this : > (a,) +

Re: tuple versus list

2005-10-16 Thread [EMAIL PROTECTED]
In this particular case, it seems that (width,height) looks nicer. But I think otherwise, list constuct is easier to read, even though it is supposed to be slower. With list you can : [a] + [ x for x in something ] With tuple it looks like this : (a,) + tuple(x for x in something) I think the li

Re: tuple versus list

2005-10-16 Thread SPE - Stani's Python Editor
It's simple: if you want to modify the data structure after it has been created, use lists, otherwise tuples. Tuples are much more memory efficient, so your program will consume less memory and probably run faster. So preferably use tuples. However with tuples you can't do: t[0] = 'new value' t.ap