Erase Vector

Hi ,

how can i remove a Vector3d from a list ?

b = []

Pt_1 = rs.getpoint()
Pt_2 = rs.getpoint()

a = rs.VectorCreate(Pt_1 ,Pt_2)
b = a

now i want to clear (( b)) and erase the Vector from it so i can have (( b )) empty and free again so i can add other vectors to it later without Vector (( a )) bothering me , how can i do that ?



maybe some of the logic in the example is off or i’m otherwise confused by the question but if you want to make b an empty list again at some point, you could just do b = [] again.

fwiw, here’s a reference on python lists/methods which i find helpful.

Hi Jeff ,
Thx for quick replay . yeah you are right its a bad example but i get what to do now , i thought i have to use something like : del list[] or erase list[] or something like that , but looks like it work the way that you told :blush:

AFAIK, there are two ways:

assigning an empty list, just like Jeff said
or using del

the former only affects one variable
the latter also affects other variables bound to the same list, if any

>>> a=[1,2,3]
>>> b=[4,5,6]
>>> aa = a
>>> bb = b
>>> a = []
>>> del b[ : ]
>>> a
>>> b
>>> aa
[1, 2, 3]
>>> bb


interesting. thanks for that