Tuple question

Bryan Olson fakeaddress at nowhere.org
Mon Sep 6 08:21:54 CEST 2004


Donn Cave wrote:

 > Quoth Bryan Olson:
 > ...
 > | Alas, that's ML, not Python.  Were that Python's designers'
 > | intent, why isn't it part of Python's design?  Why would we want
 > | to live within the confines of static typing, but without the
 > | safety and efficiency advantages of a type-checking compiler?
 >
 > That is not what is homogeneous about a list.  That would indeed
 > be an absurd contradiction, so it should be easy to convince you
 > that it isn't how anyone proposes you should use a list.  So, what
 > do they mean?

I can't tell to what you are responding.

 > A homogeneous sequence, in the sense that makes sense in Python,
 > is one where any slice is has the same functional meaning to the
 > application.  Of course the data is different and that can have
 > fundamental consequences, but it's different than (key, value)
 > for example where a[:] is the only slice that preserves its
 > meaning.

That's pretty much what lists in the ML family offer, with
static but polymorphic typing.  Lisp uses lists for both
homogeneous and heterogeneous sequences.  Python allows lists or
tuples to be treated either way.  The rule to use them based on
the homogeneous/heterogeneous distinctions strikes me more as
programming language naivete than Python expertise.


-- 
--Bryan



More information about the Python-list mailing list