This is a sample code of what I want to do...
class A():
number = 0
List = []
for i in range(5):
state = A()
state.number = i
List.append(state)
print List
Numbers = [1,2,3]
Now I want to delete class objects in List whose number is in Numbers. What is the fastest way to do it ? Also if someone can suggest a more pythonic way of doing this than by simply creating two for loops one for that of Numbers and other of List and then removing from the List.
Numbersis a list of ints. You are assigning an individual int to the.numberof each element in List. A list of numbers is never going to be the same as an individual number. Did you mean "...whosenumberis inNumbers"?