Nested function scope problem

Gerhard Fiedler gelists at gmail.com
Fri Jul 28 15:10:03 EDT 2006


On 2006-07-28 14:32:59, Dennis Lee Bieber wrote:

> On Fri, 28 Jul 2006 11:41:30 -0300, Gerhard Fiedler <gelists at gmail.com>
> declaimed the following in comp.lang.python:
> 
>> wondered (this is slightly related) is whether it wouldn't be really good
>> to make the difference between mutable and immutable objects more obvious. 
> 
> For the most part, a mutable object is one in which you can "go inside"
> -- though tuples cross the boundary (you can "go inside" to fetch an
> element, but you cant change the inside). 

It's the "for the most part" part that I was wondering about :)

So is this correct: It's mutable if you can "go inside", that is, it has an
accessor attached to the name. Unless it's a tuple, in which case it's
immutable even though it has accessors attached. Otherwise, it is
immutable. 

Or said in another way: Everything is immutable, except that collections of
objects (classes, lists, etc) may provide means to rebind members, which
then can be considered means to change objects. 

I seem to slowly wrap my mind around this... :)

Gerhard




More information about the Python-list mailing list