lists v. tuples

George Sakkis george.sakkis at gmail.com
Tue Mar 18 21:19:16 EDT 2008


On Mar 18, 5:34 pm, Duncan Booth <duncan.bo... at invalid.invalid> wrote:
> castiro... at gmail.com wrote:
> >> > > On Mar 17, 1:31 pm, Duncan Booth <duncan.bo... at invalid.invalid>
> >> > > wrote:
>
> >> > >> A common explanation for this is that lists are for homogenous
> >> > >> collections, tuples are for when you have heterogenous
> >> > >> collections i.e. related but different things.
>
> >> > > I interpret this as meaning that in a data table, I should have a
> >> > > list of records but each record should be a tuple of fields,
> >> > > since the fields for a table usually have different forms whereas
> >> > > the records usually all have the same record layout.
>
> >> >>> b in b
> >> False
>
> > That's actually interesting.
>
> Just for the avoidance of doubt, I didn't write the 'b in b' line:
> castironpi is replying to himself without attribution.
>
> P.S. I still don't see the relevance of any of castironpi's followup to my
> post, but since none it made any sense to me I guess it doesn't matter.


Plus, it does work fine over here:

Python 2.5.1 (r251:54863, May  8 2007, 14:46:30)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = []
>>> a.append(a)
>>> a
[[...]]
>>> a in a
True


George



More information about the Python-list mailing list