[Python-Dev] Customization docs

David Abrahams David Abrahams" <david.abrahams@rcn.com
Sat, 1 Jun 2002 09:32:39 -0400

From: "Guido van Rossum" <guido@python.org>

> > > > How does Python decide that sequence elements are immutable?
> > >
> > > Huh?  It doesn't.  If they were mutable, had you expected something
> > > else?
> >
> > Actually, yes. I had expcected that Python would know it didn't need
> > to "put the thing back in", since the thing gets modified in
> > place. Knowing that it doesn't work that way clears up a lot.
> Still, I don't understand which other outcome than [1, 6, 5] you had
> expected.

As I indicated in my previous mail, I didn't expect any other result.

My question was about what a new type needs to do in order for things to
work properly in Python. If, as I had incorrectly assumed, Python were
checking a type's mutability before deciding whether it would be putting
the result back into the sequence, I would need to know what criteria
Python uses to decide mutability.