i'm still pretty new to python and oop, i have the solution for my problem but it's not really performant and i think i miss something.
My code :
class User1:
def __init__(self, foo):
self.foo = foo
class User2:
def __init__(self, foo):
self.foo = foo
list_of_user1 = getUser1()
list_of_user2 = getUser2()
def do_something_to_user1():
do_something_to_user = []
for user in list_of_user1:
if user.foo not in [user.foo for user in list_of_user2]:
do_something_to_user.append(user)
for user in do_something_to_user:
something(user)
def do_something_to_user2():
do_something_to_user = []
for user in list_of_user2:
if user.foo not in [user.foo for user in list_of_user1]:
do_something_to_user.append(user)
for user in do_something_to_user:
something_else(user)
My question is, how should i compare two object of different class for multiple instance of these class . Is there a better way to do this ?