I have a parent list called parent_list
, and two subsets via which I'm to filter the parent_list
. These subsets are also python lists, and they're called filter1
and filter2
.
Can I do:
final_list = [object for object in parent_list if object.pk not in filter1 or filter2]
Or will I need to do this filteration separately, as in:
intermediate_list = [object for object in parent_list if object.pk not in filter1]
final_list = [object for object in intermediate_list if object.pk not in filter2]
I couldn't explicitly find the answer from the documentation on python list comprehensions.