List/Tuple bug or feature?

Mark McEahern marklists at mceahern.com
Tue Sep 24 18:22:02 EDT 2002


[Mahesh Padmanabhan]
> I spent a lot of frustrating hours tracking this down and I am
> confused as to why I see this behavior.
>
> >>> x = ('a' 'b')
> >>> x
> 'ab'
>
> >>> x = ['a' 'b']
> >>> x
> ['ab']
>
> As you might have guessed, I missed a comma between two elements in
> a fairly large list.
>
> If this is a concatenation feature, how can I prevent something like
> this happening in the future ?

This will sound flippant, but I don't really mean it that way:

	Put a comma in there next time.

You don't really say much about how you generated this large list, but one
idea would be to automate the process of generating it and/or fix whatever
bug led to the omission of the comma.

I don't have anything more clever than that to offer; perhaps someone else
does.

Cheers,

// m





More information about the Python-list mailing list