How to find object by user string

Hi all,

how can the object can be found by key or value after SetUserString

import rhinoscriptsyntax as rs
import Rhino as rh
import scriptcontext as sc


Thanks in advanced

I think you have to loop through all the objects to find it again:

You could create a dictionary to keep track of the guids otherwise, indexing by a tuple (key, value) for instance

Do you mean like this

Or can you post a small example how you would create a dictionary

I was thinking more of kdic[k] = id and vdic[v] = id
Or assuming you have multiple objects with the same key:

If not k in kdic:
    kdic[k] = [id, ]