On Monday, February 11, 2013 11:55:19 PM UTC-6, Chris Angelico wrote:
> On Tue, Feb 12, 2013 at 12:06 PM, 88888 Dihedral wrote:
> > A permanently mutated list is a tuple of constant objects.
>
> I nominate this line as "bemusing head-scratcher of the week".

Actually the statement is fact IF you can grok it through the eyes of clarity.

"A permanently mutated list..."

A list that has been mutated permanently, that is, it cannot be changed back 
into a list. psst: i have a sneaking suspicion that he his referring to tuples, 
let's see.

"...is a tuple..."

Ha! Well in Python the immutable sequence type /is/ a tuple after all.

"...of constant objects..."

The tuple contains objects, and it's objects will maintain a constant ordering 
(relatively in tuple structure) until until the tuple's death. 

Your confusion may stem from interpreting "constant" as the CS term 
"CONSTANT"[1]; whereby the objects in the tuple are programming CONSTANTS, that 
is, unable to change. But in reality, although a tuple (bka:StaticList) cannot 
expand to add more objects, or shrink to eject existing objects, the objects 
themselves CAN change their own internal state WITHOUT disrupting the immutable 
harmony of the tuple. 

Observe:
    
py> class Foo(object):
        pass
py> foo = Foo()
py> t = (1,'1', foo)
py> t
(1, '1', <__main__.Foo object at 0x0267BF50>)
py> t[-1].bar = "abc"
py> t
(1, '1', <__main__.Foo object at 0x0267BF50>)

Or by expanding a list

py> t = (1,2,3)
py> t = t+([],)
py> t
(1, 2, 3, [])
py> t[-1].append('circus')
py> t
(1, 2, 3, ['circus'])

[1] Which is an unfortunate side-effect of polysemy and compounded 
exponentially by naive (and sometimes a purely malevolent intent when) 
transformation of words into esoteric problem domains.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to