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 : > > [a] + [ x for x in something ] > > > > With tuple it looks like this : > > (a,) + tuple(x for x in something) > > > > I think the list looks cleaner. And since you cannot concat tuple with > > list, I think unless it looks obvious and natural(as in your case), use > > list. > > > > > 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 term "sequence", since in Python it is defined to include tuple. I gather you meant more in the abstract sense of a data collection whose interesting properties are of a sequential nature, as opposed to the way we are typically more interested in positional access to a tuple. Maybe a more computer literate reader will have a better word for this, that doesn't collide with Python terminology. My semi-formal operational definition is "a is similar to a[x:y], where x is not 0 or y is not -1, and `similar' means `could be a legal value in the same context.'" Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list