I have a Python list filled with instances of a class I defined.
I would like to create a new list with all the instances from the original list that meet a certain criterion in one of their attributes.
That is, for all the elements in list1, filled with instances of some class obj, I want all the elements for which obj.attrib == someValue.
I've done this using just a normal for loop, looping through and checking each object, but my list is extremely long and I was wondering if there was a faster/more concise way.
Thanks!