Getting references to obect instances into a list

parent.eric.3 at gmail.com parent.eric.3 at gmail.com
Wed Aug 27 11:49:41 EDT 2008


Ok then, my mistake: I thought 'del' was deleting the object AND
releasing the name for later user. Sorry!

This is what I should have tried in the first place:

>>> m = [2,3,4]
>>> p = ['a','b','c']
>>> l = [m,p]
>>> l
[[2, 3, 4], ['a', 'b', 'c']]
>>> p.append('w')
>>> p
['a', 'b', 'c', 'w']
>>> l
[[2, 3, 4], ['a', 'b', 'c', 'w']]
>>>


>
> What did you expect for an "updated q" anyway?
>

I am about to work on a graph where all vertices are objects
containing labels (for computing shortest paths for example) and I
plan to gradually update my labels (object's member variables). I just
wanted to make sure it was possible and what was the appropriate
mechanism.

Thanks to all of you three for shaking my thoughts. I'll try not to
ask so dumb questions again

   ;o)

- Eric



More information about the Python-list mailing list