terminological obscurity

Colin J. Williams cjw at sympatico.ca
Sat May 22 12:59:32 EDT 2004



David Eppstein wrote:
> In article <40aec6ff$0$17254$a1866201 at newsreader.visi.com>,
>  Grant Edwards <grante at visi.com> wrote:
> 
> 
>>>Can't it be said, in helping to distinguish a Python list from the
>>>standard collections in, say, Java and C++ - that among its most
>>>important attributes is the ease with which one can work with a list
>>>as a collection of objects of *heterogenous* type. "Type" here being
>>>used in the sense that programmers generally use the word.
>>
>>I think the fact that Python lists can be heterogogenous is one
>>of the most brilliantly useful things in the language, but
>>apparently we're not supposed to use lists like that.
> 
> 
> It's not heterogeneity of type you're supposed to avoid, it's 
> heterogeneity of purpose.  That is, you should be intending to treat 
> each cell of the list similarly.
> 
Section 3.2 of the Python Reference Manual has
    Tuples: The items of a tuple are arbitrary Python objects.
    Lists:  The items of a list are arbitrary Python objects.

The generality of that seems clear.  Can we not leave 'purpose' to a 
book of best practices?

Colin W.




More information about the Python-list mailing list