Lists and Tuples and Much More
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Thu Apr 12 19:01:51 EDT 2007
Scott:
Others will give you many more answers, here is just a bit.
> And how would you sort the list that's in the list? I guess that goes in
> conjunction with the section above, but still:
>>> my_list = [6, 4, 3, 5, 2, 1]
> >>> my_list.append([7, 9, 8, 10])
> >>> my_list.sort()
> >>> my_list
>
> [1, 2, 3, 4, 5, 6, [7, 9, 8, 10]]
Such sorting may be impossible in Python 3.0 (comparing the order of
lists with integers may be seen as meaningless. Otherwise you can see
single numbers as lists of len=1, like another language does).
> This is, again, something I'm finding nothing on.
Maybe because documentation requires some generalization capabilities.
A list is a single object, and it can contain a sequence of objects.
Bye,
bearophile
More information about the Python-list
mailing list