List vs tuple (was: [PATCH 2 of 3] convert/mtn: use mtn "automate stdio" when available)
Dirkjan Ochtman
dirkjan at ochtman.nl
Thu Mar 24 08:30:37 UTC 2011
On Thu, Mar 24, 2011 at 09:21, Martin Geisler <mg at aragost.com> wrote:
>> People usually prefer tuples for constant sequences of items.
>
> Thinking about it, I prefer lists when the index of a particular item is
> not important and tuples when it is. That is, a tuple has more structure
> than a list and when the structure is unimportant, I prefer a list.
>
> Do others put more emphasis on the mutable vs immutable aspect of lists
> vs tuples?
Sure, on the structure.
Actually, when testing containment, using a set() is an even better
solution. (Also, I find "x not in y" more readable than "not x in y".)
Cheers,
Dirkjan
More information about the Mercurial-devel
mailing list