Newbie References Question -> Exemple

Guy Rabiller grabiller at 3dvf.net
Thu Sep 26 01:00:37 EDT 2002


>         So just use
>
> quad = p

That could be an option but what I wrote was just an 'exemple'.

In the 'real world' I have to deal with points order, different lists of
points, etc..

But thanks anyway.

--
guy rabiller
3d animator / td
grabiller at 3dvf.net
http://grabiller.3dvf.net

Dennis Lee Bieber wrote:
> Guy Rabiller fed this fish to the penguins on Wednesday 25 September
> 2002 08:14 am:
>
>> Ok,
>>
>> thanks for your answers, I understand now that a variable name is
>> 'just' a name in a dictionary, and not a container.
>>
>> What I want to do is simple, and I suppose that this is my 'way of
>> thinking' regarding Python that is wrong.
>>
>> I have a list of points, and a list of polygons that should contain
>> 'references' to points.
>>
>> So for me:
>> -> points list:
>> p = []
>> p.append([0,0])
>> p.append([0,1])
>> p.append([1,1])
>> p.append([1,0])
>> -> polygon:
>> quad = []
>
>         Created a /new/ list
>
>> quad.append(p[0])
>
>         appended the value of p[0] to the new list
>
>> For me the quad list of point is not 'updated' with the change of one
>> of its point.
>>
>         So just use
>
> quad = p
>
> which binds "quad" to the /same/ value that p is bound to.
>
>
>         Strangely, I had the opposite problem two years ago, when
> trying to "save state" for small test set. I was using the simple
> assignment and finding that I wasn't saving the state but making a
> reference (your term) to it.





More information about the Python-list mailing list