Nick Maclaren schrieb:
> In article <[EMAIL PROTECTED]>,
> "Glenn Hutchings" <[EMAIL PROTECTED]> writes:
> |> Fredrik Lundh wrote:
> |> 
> |> > if you don't want to understand the design, nobody can force you.  but 
> arguing
> |> > that the people behind the design "don't get it" isn't very practical.
> |> 
> |> I'm not arguing that at all.  What I'm saying is that from the
> |> perspective of someone not interested in design issues, it seems like
> |> an omission for tuples to be missing the non-modifying methods that
> |> lists have.
> 
> And, from the perspective of someone VERY interested in design issues,
> from the viewpoint of program validation (a.k.a mathematical models,
> a.k.a. 'program proving' a.k.a. 'software engineering') it also seems
> like one!
> 
> If lists are intended to be homogeneous, then they should be checked
> for that, and an exception raised when an attempt is to make them
> non-homogeneous.  At least as a Python checking option.

There you have the "consenting adults" philosophy again: You know what lists
are for, so you can use them for it. You can also use them for something else,
but in that case it's moot to complain about missing features.

> If tuples are intended to be bags, then it makes no sense to allow
> them to be subscripted OR indexed.  Mathematically, 'x = a[i]' and
> 'i = a.index(x)' have dual properties - and are true duals if you
> include the constraint of no duplicate elements.

You're describing sets. Tuples are not sets. Sets are not indexable and have
unique elements.

Indexing is the *vital* point of tuples. They are an ordered collection of
values, and you are supposed to know which data is found at which index.
Don't tell me that tuples in maths are sets.

For a mathematical example, take

A = { (x,y) : 0 < x < 1, 0 < y < 1 }

Here, (x,y) is a 2-tuple, and you know that at index 0 there's the x-coordinate
of a point contained in the square A, and at index 1 there's the y-coordinate.

Georg
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to