Re: space effecient representations of list subsets (addendum)

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Fri, 3 Dec 1993 14:02:15 -0500

On Dec 3, 13:11, "I" wrote:
>
> Of course, implicit in the previous long discussion, was the question:
> "Is any of that necessary? "
> That is, am I misunderstanding when things are a value and when they
> are a reference, and is the obvious [ list[1], list[22], ... ] actually
> the right thing to do ?
>

Another instance where attempting to refine my problem into a
question has suggested to me how to answer it myself.

>>>list = [1,2,3]
>>>sub = [ list[-1], list[0] ]
>>>if id(list[0]) == id(sub[-1]) : print 'EQ'
...
EQ

So, I think a big "Nevermind!" is called for here!

Sorry to take up your time guys, but I'll post this one more message,
so you won't have to waste MORE time trying to explain it all to me.
( Unless you think I STILL don't get it! )

Note that:

>>> one = 1
>>> if id(1) == id(one) : print 'one'
...
>>>
>>> if id(1) == id(1): print 1
...
1

The fact that it does the "right" thing here - that the constant
"1"'s are the same object while different from another object
with value = "1" is interesting, and I guess a result of
how python compiles constants in it's intermediate code.

Oh well - Nevermind! :->
- Steve