[Zope] Zope needs this (and Dynamo has it)

Patrick Phalen zope@teleo.net
Mon, 13 Mar 2000 12:21:21 -0800


[Alexander Staubo, on Mon, 13 Mar 2000]

:: I'm not contesting that dictionary keys should be immutable, but rather
:: that lists and tuples are nearly the same things (*nearly*, but not
:: quite) with the crucial difference that lists are mutable. Why? There's
:: no real design here. The only scientific answer to that question is
:: "Because."

Seems like this discussion should be moved to c.l.p., but ...

I don't understand your objection here. Tuples are immutable "by
design," or "by definition" if you prefer.

What alternative approach would you suggest?

We certainly benefit from having a mutable sequence type designed to
contain arbitrary objects.

We benefit from having a high level mapping type designed into the
language. You agree that dictionary keys must be immutable and you
appear to agree that sequences make useful keys, as well.

Under the covers, we also benefit from Python's design choice that
assignments create object references and the design choice that
dictionaries hash object references, not the objects themselves (which
therefore requires immutable keys).

So what's wrong with Guido setting things up this way and then saying,
"hmmm, this is pretty cool, we just need an immutable sequence type for
use in dictionary keys."

It's a little like the Old Testament Creation mythology. God creates the
heavens and the earth and he sees that it is good. But he decides he
needs to populate it. He finds that one human type isn't enough -- it
gets lonely. So it turns out that in His world, he needs two essentially
similar types, but with a key difference.

So Guido took a rib from the list and made the tuple.  ;)