tuple.index()

Nick Maclaren nmm1 at cus.cam.ac.uk
Thu Dec 14 10:19:34 EST 2006


In article <1166106278.106832.278240 at n67g2000cwd.googlegroups.com>,
"Glenn Hutchings" <zondo42 at googlemail.com> 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.

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.

I remain baffled.  I accept the explanations, but what I am now
confused by is the reason for the explanations ....


Regards,
Nick Maclaren.



More information about the Python-list mailing list