Lets assume the following object:
class Test:
id1 = ""
id2 = ""
id3 = ""
def __init__(self,arg1,arg2,arg3):
self.id1 = arg1
self.id2 = arg2
self.id3 = arg3
As it can be seen, this class must contain 3 unique ids.
t = []
t.append(Test(200,201,193))
t.append(Test(403,221,213))
t.append(Test(3,523,2003))
Assuming the code above, what would be the easiest way for me to find the object with id1 = 403, id2 = 221, and id3 =213 in the list t?
Thanks in advance.
t, or can you sort it? Will you be looking up instances withintrepeatedly?id1 = ""aren't necessary or helpful.objectrather than nothing, which will make you use "new-style classes". There are various benefits to doing so, but you don't have to think about them much until you need them later on.