[Tutor] tuple & object's attributes (changed)

Andre Engels andreengels at gmail.com
Sat Jan 3 00:04:24 CET 2009


On Fri, Jan 2, 2009 at 10:37 PM, Kent Johnson <kent37 at tds.net> wrote:
> Forwarding to the list with comments.
>
> On Fri, Jan 2, 2009 at 2:47 PM, spir <denis.spir at free.fr> wrote:

>> Now, remains one major question:
>> Why do lists hold heterogeneous items? (Why did Guido do that choice, and then assert that
>> lists are for homogeneous sequences).

I think that this mostly shows that 'homogenous' and 'heterogenous'
are a bad choice of words here. What really is the issue here, is not
so much whether or not the elements are of the same type, but whether
or not they are 'interchangeable'. That is, if something could be the
second element, it could be the first or fourth element as well, and
it would mean basically the same thing.

In fact, a list where every element could be anything is _homogenous_,
so there is no real way of restricting lists to only hold homogeneous
items (and that apart from Kent's fully correct statement that such a
restriction would be very unpythonic).

-- 
André Engels, andreengels at gmail.com


More information about the Tutor mailing list