Python 3.0 - is this true?

Diez B. Roggisch deets at nospam.web.de
Sun Nov 9 15:01:09 CET 2008


> 
> Also, I thought that part of the python philosophy was to allow any
> sort of object in a list, and to allow the same methods to work with
> whatever was in list.

Not really. When the usual argument about the existence (and 
justification) of lists & tuples comes along, one common distinction is 
that

  - tuples contain arbitrary object of varying types, so they are kind 
of "records"
  - lists should contain uniform objects.

None of this is enforced, but it's good customs to do so & to put it 
frankly: if I came along a piece of code that created a list like the 
one you presented, I'd say it's a code-smell.

Diez



More information about the Python-list mailing list